I'm using the option Label string for my Html.DropDownList but my datasource is a SelectList. How I would check for the option label back on the server? The backing type for the variable is an EnumType. I inspected the value and it says 0 but it won't let me check for 0.
Than开发者_开发知识库ks, rod.
How about casting the value back to the enum type on the server:
[HttpPost]
public ActionResult Index(int selectedValue)
{
MyEnum label = (MyEnum)selectedValue;
...
}
You can't. Labels aren't posted with the form. You'll need to place the value in a <input type="hidden">
if you want the value.
精彩评论