开发者

DropDownListFor in ASP.NET MVC 3 WebGrid

I have a WebGrid that I'm creating and I want a dropdownlist in there - I can't find a way to make one of the rows a DropDownList - any tutorials out there?

Right now i've been trying to use the "format:" setting to set it up开发者_开发技巧 - but I keep getting errors


Assuming that your model includes something like this:

public SelectList Countries { get; set; }

in the Metadatatype for your class and your controller populates the list, you can then call the DropDownList inside the webgrid:

myGrid.Column(header: "", format: @<text> @Html.DropDownList("Countries")</text>),

After finding the answer, it is obvious; but I was tearing my hair a few minutes ago.

Hope this helps someone keep his/her hair.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜