ASP.NET MVC 3 HtmlHelper.Textbox Uses ModelState as a source for value?

后端 未结 1 1513
说谎
说谎 2020-12-18 17:31

I have a textbox that I am trimming the value of server side in the viewModel\'s setter and verifying that the trimmed value is present:

    

        
相关标签:
1条回答
  • 2020-12-18 18:10

    This was designed this way because the assumption is if you are not redirecting to another view after a post .. Hence the post-redirect-get pattern, then there was ideally an error and the current posted values would be shown back to the user for them to fix hence why they are pulled from modelstate. You can ModelState.Clear to work with this but keep that design in mind.

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