Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个正在创建的 WebGrid,我想要一个下拉列表 - 我找不到将其中一行设为 DropDownList 的方法 - 那里有任何教程吗?
现在我一直在尝试使用“格式:”设置来设置它 - 但我不断收到错误
假设您的模型包含以下内容:
public SelectList Countries { get; set; }
在您的类的元数据类型中,并且您的控制器填充列表,然后您可以在 webgrid 中调用 DropDownList:
myGrid.Column(header: "", format: @<text> @Html.DropDownList("Countries")</text>),
找到答案后,一目了然;但几分钟前我还在扯头发。
希望这可以帮助某人保持他/她的头发。