MVC4 Razor - @Html.DisplayFor not binding to model

后端 未结 6 1748
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 07:15

I am trying to find me feet with MVC4 Razor and I\'m stuck with this simple problem.

When I use @Html.DisplayFor the model is always sent back as NULL, but when I u

6条回答
  •  北海茫月
    2020-12-08 07:29

    Use both DisplayFor and HiddenFor. DisplayFor simply displays the text and is not an input field, thus, it is not posted back. HiddenFor actually creates

提交回复
热议问题