ASP.NET MVC 3 Ajax.BeginForm and Html.TextBoxFor does not reflect changes done on the server

前端 未结 2 984
情书的邮戳
情书的邮戳 2021-01-01 03:05

I\'m using the Ajax.BeginForm helper in ASP.NET MVC3 to submit a form that replaces itself with new values in the form set on the server. However when I use helpers like Htm

相关标签:
2条回答
  • 2021-01-01 03:40

    in your POST method you need to do

    ModelState.Clear();
    

    to reflect the changes made after the post

    0 讨论(0)
  • 2021-01-01 03:54

    you can use

    ModelState.Clear() 
    

    in your controller method to make the html helpers use your changed model. Otherwise they use the values from the form submit

    Have a look at: Asp.net MVC ModelState.Clear

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