ASP.net MVC DropDownList Pre-Selected item ignored

后端 未结 3 1011
说谎
说谎 2021-02-08 17:44

I am facing a simular problem as outlined in the question \"Html.DropDownList in ASP.NET MVC RC (refresh) not pre-selecting item\"

I\'m using ASP.net MVC 1.0 and need to

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 18:22

    Found the Answer

    When the Name given to the control (the first parameter in this case being "SelectList") is the same as one of the Keys in the ViewData dictionary basically it screws up and ignores the pre-selected item in the SelectList

    By simply renaming the DropDownList it works correctly and binds to the Pre-Selected item

提交回复
热议问题