my application is MVC3 using ASPX views. I have two pages, create and Edit, using the following dropdownlist:
<%= Html.DropDownList("VesselDiameter", new SelectList(new[] { "", "1", "2", "3"}))%>
It works in create view and saves the data to the MS Sql table, however the value does not show in the edit view. If I use,
<%: Html.EditorFor(model => model.pRCA.VesselDiameter) %>
I used a similar dropdownlist in another view and it worked, but the model is different:
<%= Html.DropDownList("Vessel", new SelectList(new[] { "", "1", "2", "3"}))%>
instead of
<%: Html.EditorFor(model => model.Vessel) %>
The value is there! Would appreciate your suggestions. Thanks in advance.
for Model.pRCA.VesselDiameter mvc generates this id (“pRCA.VesselDiameter”) so you should prepend pRCA to id value