MVC DropDownList SelectedValue not displaying correctly

后端 未结 7 942
甜味超标
甜味超标 2020-12-01 12:40

I tried searching and didn\'t find anything that fixed my problem. I have a DropDownList on a Razor view that will not show the the item that I have marked as Selected in th

相关标签:
7条回答
  • 2020-12-01 13:10

    I leave this in case it helps someone else. I had a very similar problem and none of the answers helped.

    I had a property in my ViewData with the same name as the selector for the lambda expression, basically as if you would've had ViewData["StatusId"] set to something.

    After I changed the name of the anonymous property in the ViewData the DropDownList helper worked as expected.

    Weird though.

    0 讨论(0)
提交回复
热议问题