ASP.Net viewstate questions on form postbacks

北慕城南 提交于 2019-12-08 02:52:37

问题


Let's assume I have a very simple form, with a submit button and a dropdown list. When I change the list entry and hit submit, at what stage in the postback processing does the viewstate reflect my changed list entry?

According to O'Reilly's Learning ASP.Net 3.5, there are two loads taking place-- one before form validation and another after (diagram on page 266 for those with a copy).

According to the diagram the viewstate is loaded during the first load stage, before the validation. I assume my changed dropdown is reflected at this point?

Also, according to the diagram, posted data is processed twice, both before and after validation. Could anyone elaborate a little more on this, and what form processing takes place at each point?

Thanks for the help. It's a little misty, what takes place when and I'm trying to clear it up a bit.


回答1:


The viewstate is loaded after page initialization but before page load. Validation takes place just before the event triggers for the button that caused the validation.

  • ASP.NET Page Life Cycle Overview
  • Understanding ASP.NET View State
  • ASP.NET Validation in Depth


来源:https://stackoverflow.com/questions/1514979/asp-net-viewstate-questions-on-form-postbacks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!