Monday, July 4, 2011

ASP .Net MVC DropDownList selected value confusion

I just spent an hour around this silly problem. Well its confusing enough from the doc and I should probably blog here so that noone gets into it spending hours.

 <%= Html.DropDownListFor(h => h.HotelMarket.ID, new SelectList(Model.Markets, "Market", "Market", Model.HotelMarket))%>

here you should remember that  h.HotelMarket.ID is the property to be binded to and Model.HotelMarket is the object that this property belongs. Simple but confusing...




No comments:

Post a Comment