开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜