ASP.NET MVC dropdownlist not selecting value on render

前端 未结 8 747
感动是毒
感动是毒 2020-12-29 12:56

I have this annoying problem where my DropDownlist doesn\'t select the current value by default.

Controller:

var YearsCycling = new SelectList(new Li         


        
8条回答
  •  暖寄归人
    2020-12-29 13:17

    I'm sure you're way past this, but I just got burned on this a moment ago because I had named the dropdown list the same name as the property in my view model class.

    Changing the dropdown list name to something else cured it right up.

提交回复
热议问题