There is no ViewData item of type 'IEnumerable' that has the key 'GradingId'

前端 未结 3 1441
庸人自扰
庸人自扰 2020-12-22 08:33

Im trying to get a drop-down list to work for users who are being graded. Each user can have multiple gradings. So when i create a new grade i want a drop-down to specify

3条回答
  •  没有蜡笔的小新
    2020-12-22 09:06

    Although it's not part of your question, you're going to run into an entirely different problem once you get this operational. The name of your ViewBag item cannot be the same as the name of your property. Otherwise, the selected value will never be selected as the value in ViewBag will override the value on your model.

    Name your select list something like GradingIdChoices, not GradingId to disambiguate it.

提交回复
热议问题