DropDownListFor in ASP.NET MVC 3 WebGrid

I have a WebGrid that I create and I need a dropdown there - I can't find a way to make one of the DropDownList lines - any tutorials there?

Now I'm trying to use the "format:" parameter to configure it, but I keep getting errors

+3
source share
1 answer

Assuming your model includes something like this:

public SelectList Countries { get; set; }

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

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

After finding the answer, this is obvious; but several times ago I tore my hair.

Hope this helps someone keep their hair.

+3
source

Source: https://habr.com/ru/post/1793460/


All Articles