How to set the option value through model

Posted by user281180 on Stack Overflow See other posts from Stack Overflow or by user281180
Published on 2010-03-24T11:42:41Z Indexed on 2010/03/24 11:53 UTC
Read the original article Hit count: 158

Filed under:
|

I need to have the value for the option in the following:

I have created my select as follows:

 <select id="fromSelectBox" multiple="multiple" >

          <% foreach (var item in Model.Projects) { %>
                   <option><%=Html.Encode(item.Text)%></option> 
                <%} 
            %>
            </select>

How do I set the value of the option using the value in the model which s item.ID?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about dropdownlist