asp.net mvc 3 - Drop down box in edit.cshtml -
i creating asp.net mvc 3 application references database , within edit.cshtml file wish limit edit function of 1 of items (score) either 0,1,2,3,4. have tried options in post converting html.editorfor drop down (html.dropdownfor?) cannot seem working.
<div class="editor-label"> @html.labelfor(model => model.score) </div> <div class="editor-field"> @html.editorfor(model => model.score, "yesnodropdown") @html.validationmessagefor(model => model.score) </div> many thanks.
chri3
if don't forsee needing changed often, i'd use static select below:
<div class="editor-label"> @html.labelfor(model => model.score) </div> <div class="editor-field"> <select id="score" name="score"> @for(int i=0; i<5; i++){ <option value="@i" @(model.score==i ? " selected": "")>@i</option> } </select> </div>
Comments
Post a Comment