ViewState and Server Controls ASP.NET PageLifeCycle

How does view state data value assigned to controls on Html form or How user inputs value retained after post back.

This is all above comes in PageLifeCycle and we can find many articles on that. I have small understanding on very important thing and I would like share..

When Post Back happens or any server side event fired their are major event which plays role to retain data of view state.
LoadPostBackData – This function is only applicable for Postback. When the page is given to asp.net engine with all markup asp.net engine calls for several functions to complete the server side load.
Browser on event firing or postback will pass on the values to ASP.NET engine using HTTP POST header which actually has _VIEWSTATE.
IPostBackDataHandler interface will take care of calling LoadPostdata function for all the server controls for which loading view state is applicable.All listed controls in IPostBackDataHandler will have call for LoadPostdata () method like textbox, listbox. So here we can see that its not viewstate which is only responsible for loading user input to controls.

Page Load – In this event the load view state happens along with post back data.

Save View State -In this stage Page class construct View State for page which has to be maintained across post back. It is called according to the hierarchy defined in Page Instantiation for all the controls(stored in the WINDOWS\Microsoft.NET\Framework\version\Temporary ASP.NET Files).

Very nice explanation of page life cycle and role of view state is written here

Happy programming..

Number of View :738
  1. No comments yet.

SetPageWidth
Content Protected Using Blog Protector By: PcDrome.

Mahol Dot Org is Stephen Fry proof thanks to caching by WP Super Cache