Programming, Web News, Web Hostings, Technology
ASP.NET MVC DropDownList and HTML Attributes « Rob Conery
I setup the Controller to creaet a SelectList, like so:
NorthwindDataContext db = new NorthwindDataContext(); var categories = from c in db.Categories select c; ViewData["CategoryID"] = new SelectList(categories, "CategoryID", "CategoryName");Then, in my View I rendered the DropDownList:
=Html.DropDownList("CategoryID",ViewData["CategoryID"])%>
This is very important if you are using Html.DropDownList in MVC
Posted via web from Ervin Ter’s posterous
Related posts:
- Macy – Thursday Special via macyhomefurnishings.com Prices on Thursday 12th November 2009 only Location:...
- C# Send New Post to Posterous Posterous has a set of API for developer to call...
- Microsoft Application Architecture Guide 2nd Edition from Patterns & Practices Microsoft Patterns & Practices released the 2nd edition of their...
- Two Improvement Needed For Posterous Robot Two Improvement Needed For Posterous Robot 1. Drag and Drop...
- My new keyboard and mouse Posted via email from Ervin Ter’s posterous...
| Print article | This entry was posted by ervinter on November 12, 2009 at 9:29 pm, and is filed under Programming. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |