3

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

Aaron
  • 31
  • 3

1 Answers1

3

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.

jelizondo
  • 31
  • 2