I have a DropdownList in my View with stored Enum Values.
public enum UserRole
{
ADMINISTRATOR = 1,
APPROVER = 2,
ORDER = 3
}
@Html.DropDownListFor(model => model.New_User.Role , new SelectList(Enum.GetValues(typeof(soukohin.Models.Admin.UserRole))), "Select Role", new { @class = "form-control", @id = "new_role", @placeholder = "役割" , @onchange = "getRoleInformation(this)" })
after selecting the value, I want to get the Integer value of this from Javascript.
I tried this code, but the return value is the Name of Enum.
function getRoleInformation(value) {
alert(value.value);
}
SAMPLE RESULT: ORDER
How can I get the integer value, not the name of the enum?