The enableviewstate attribute of the page object is false, meaning that the viewstate of the entire page (including all server-side controls) is disabled, however, <input type = "hidden" name = "_ viewstate" value = ".... "/> does not disappear. viewstate does not work at this time.
The text content of textbox is placed in the data set of post to the server, and textbox implements the ipostbackdatahandler interface, which calls ipostbackdatahandler before the page_load event. the loadpostdata method updates the response textbox Based on the name attribute of the Post-returned HTML element and the uniqueid attribute of the server-side control. text attribute. If the new data is different from the old text attribute, loadpostdata returns true, so that the later raisepostdatachangedevent will be called, this event will finally call the ontextchanged method to trigger textbox. textchanged event, and then, in the render event, textbox will render its text attribute, so that the final displayed textbox content will remain. (Note: The uniqueid attribute is very important here. You must set the name attribute to uniqueid during render; otherwise, the loadpostdata method cannot find the correct server-side control match, for more information, see "processing PostBack Data ")
Note: although the text attribute of textbox is implemented using viewstate, viewstate is disabled at this time, however, if viewstate is disabled, it means that the loadviewstate and saveviewstate methods do not save the viewstate object content in the server content in <input type = "hidden" name = "_ viewstate" value = ".. .. "/> the viewstate object in the memory can still be used. It can be proved as follows:
Private void page_load (Object sender, system. eventargs E)
{
This. viewstate ["test"] = "test ";
This. response. Write (this. viewstate ["test"]. tostring ());
}
When viewstate is disabled, the "test" string will still be written, which indicates that the viewstate object in the memory can still be used.
For more information about the server-side controls that return post data, see "control execution lifecycle"
Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/cpguide/html/cpconcontrolexecutionlifecycle. asp
"Processing PostBack data"
Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/cpguide/html/cpconreceivingpostbackdatachangedications ications. asp
The following Article describes the detailed implementation of the simulated textbox Source Code :
"PostBack data processing sample"
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconpostbackdataprocessingsample.asp