MVC - DropDownList wrong option selected when value from model is null
I have two DropDownLists in form, both displaying list of regions. First is required, second not, stored as null in db. When I open the page for edit and first dropdownlist is ie. Region 2, and the second is null, the first option "< not specified >" should be selected in second dropdownlist, but the same op开发者_如何学JAVAtion as in first dropdownlist is selected. When I check for null in controller and set the property to value, which is not in the dropdownlist, ie. -1, it selects corrects first option "< not specified >".
Is there a way to recieve the first option selected, when the model value for this dropdown is null ?
kubiix
精彩评论