开发者

DropDownList in ASP.NET MVC3 Razor view

开发者 https://www.devze.com 2023-03-06 21:28 出处:网络
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 workin

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

0

精彩评论

暂无评论...
验证码 换一张
取 消