你可以尝试类似的东西here https://stackoverflow.com/questions/9517627/converting-html-editorfor-into-a-drop-down-html-dropdownfor:
<%= Html.DropDownList(
"",
new SelectList(
new[]
{
new { Value = "true", Text = "Yes" },
new { Value = "false", Text = "No" },
},
"Value",
"Text",
Model
)
) %>
如果你想要一个默认值:
<%= Html.DropDownList(
"",
new SelectList(
new[]
{
new { Value = "", Text = "None" },
new { Value = "true", Text = "Yes" },
new { Value = "false", Text = "No" },
},
"Value",
"Text",
Model
)
) %>