curiouswebster
asked on
Need a demo MVC app that fills a drop down list in the View
I have used Nerd Dinner as an example but can not get that one to work for me. Does anyone have a demo I can download that uses HTML.DropDownListFor to populate a list? I am having problems doing that successfully.
Thanks,
newbieweb
Thanks,
newbieweb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Question.
Do I need to add each item in the aspx file? Or shoudl the following be sufficient?
Html.DropDownListFor(model => model.role, ViewData["RoleList"] as SelectList)
Maybe I misunderstood Nerd Dinner. I see Musis Store has the attached code. But I have not looked at it very long to try and figure it out myself....
Do I need to add each item in the aspx file? Or shoudl the following be sufficient?
Html.DropDownListFor(model
Maybe I misunderstood Nerd Dinner. I see Musis Store has the attached code. But I have not looked at it very long to try and figure it out myself....
<% foreach (var genre in Model) { %>
<li>
<%: Html.ActionLink(genre.Name, "Browse", "Store", new { Genre = genre.Name }, null)%>
</li>
<% } %>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. For the record, I had not yet overrridden ToString(), which I think is why I got the list filling with MyProgram.Models.User.
ASKER
Now on to the Music Store...