Nullable enum in html helper
- by Fabien Piron
I have a view model that contains enum with nullable type like this one :
public StudyLevel? studyLevel { get; set; }
I have made custom html helper to display a dropdownlist for rendering the enum into the view, the nullable case is displayed using
<option value="null">No value</option>
the problem is that when i submit the form modelstate give me the error :
studylevel cannot be "null" .
Could you suggest me any way to help me handle the nullable type in the view ?