Why mvc Html.HiddenFor does not render my field?

后端 未结 4 903
甜味超标
甜味超标 2020-12-15 07:08

I\'m trying to do this simple thing

<%= Html.HiddenFor(model => model.Id)%>

the model is

[HiddenInput(DisplayValu         


        
4条回答
  •  情书的邮戳
    2020-12-15 07:41

    My comment is relegated to the last place (even I couldn't find it), so:

    In case you don't want to clear the modelstate, as Darren Oster suggested, removing the problematic key worked for me: ModelState.Remove("HiddenKey")

提交回复
热议问题