I a razor view .I have line like bleow
<option value='@{(Int16)PhoneType.Work}'>@PhoneType.Work</option>
This is an option in a select list/dropdownlist In this I have an enum PhoneType. For text filed @PhoneType.Work works fine but for value field @{(Int16)PhoneType.Work is not working
What can i do to get integer value of the enum at value field
This syntax should do the trick (note the () instead of {}):
<option value='@( (Int16) PhoneType.Work )'>@PhoneType.Work</option>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With