DropDownList in ASP.NET MVC3 Razor view
I am new to ASP.NET MVC3!! I want to display a text box for my property which is of list type. I am using Razor 开发者_开发百科view. In that i am using @Html.EditorFor(), but this method is not working if my property is complex like List. Also I want to display a Dropdown in my view.
Can anyone tell the solution for this? Thanks!!!
@Html.DropDownListFor(x=>x.Property.Select(y=>y.InnerProperty))
will probably get you displaying what you want but you will have trouble model binding
w://
I had a similar question to this. Hope it helps you out: DropDown for Edit() [Razor]View, Pre-Loaded with Data from Model
Possibly this one also: Create a Dropdown List for MVC3 using Entity Framework (.edmx Model) & Razor Views && Insert A Database Record to Multiple Tables
Tim
精彩评论