Hi,
How to dynamically bind data to <%Html.Dropdownlist.... in asp.net MVC?
Regards, Ambika
Hi,
How to dynamically bind data to <%Html.Dropdownlist.... in asp.net MVC?
Regards, Ambika
Just pass the correct IEnumerable as the typed model or ViewData. Try something like this (out of my head):
<%= Html.DropDownList(string.Empty,
"myDropDownList",
new SelectList((IEnumerable)ViewData["stuff"],
"DescriptionProperty",
"ValueProperty"))
%>
With that drop down list helper in MVC, you do not really "bind" data to it in the way it is done in the old ASP.NET.
hi i am shivani.i m having problm in drop down list,the items added in d aspx page are nt adding in drop down list at run time.they are being displayed but at the side of drop down list and not inside it.soplease help me asap.