This session is a brief on the pre page life cycle events(Just a quick route map), the Page life cycle events, how is Viewstate important to page life cycle events & Life without Viewstate.
2. Agenda Of The Seminar
-
Pre Page Life Cyle (Asp.Net Inside IIS)
What on Earth is ViewState?
The different (Important) stages of Life Cycle
Where ViewState comes into the picture?
Dynamically created control
Deal with the burden of ViewState on the page
Some Demo...with some more Demo
Conferrer: Vijay Goyal, Mindfire Solutions
3. This is not an IIS course
Conferrer: Vijay Goyal, Mindfire Solutions
4. The Two Important Services
Conferrer: Vijay Goyal, Mindfire Solutions
5. The ProcessRequest()
- After all the registered
Modules are executed. The
page is ready to be served.
- For this IIS uses the
handler's mapping, to map
the request to the
appropriate handler.
- ProcessRequest() method is
executed and Page Life Cycle
begins
Conferrer: Vijay Goyal, Mindfire Solutions.
6. The Page Life Cycle Begins..
Conferrer: Vijay Goyal, Mindfire Solutions
7. Formation Of Control Heirarchy
- Request to an aspx page is served by a compiled
class
“C:WindowsMicrosoft.NETFrameworkv4.0.30319Temp
orary ASP.NET Files”
- Initializes the page's control hierarchy
Conferrer: Vijay Goyal, Mindfire Solutions
9. But What's ViewState??
-
Its a misunderstood topic
An object of Statebag class
Stores changes done programatically
SelectedIndex / PageIndex not stored
A property of System.Web.UI.Controls
A key/value pair indexer.
Serialized to _VIEWSTATE hidden field
ViewState is a hungry beast.
Conferrer: Vijay Goyal, Mindfire Solutions
10. Initialization
- PreInit (Entry point, Non Recursive)
- Init (Tracking of Viewstate
is not enabled
/ Enabled for child controls, Recursive)
- InitComplete (Viewstate tracking
is turned on, Non Recursive)
- SaveViewState()
- Page.TrackViewState()
Conferrer: Vijay Goyal, Mindfire Solutions.
11. Load ViewState/Page Data
- Invoked only on Postbacks
- LoadControlState (Introduced in Asp.Net 2.0,
gridview page control, SaveControlState()l)
- LoadViewState
SaveViewState())
- LoadPostData
(Page and controls restored,
(Controls implement IpostBackDataHandler,
Selected value in dropdown, checkbox, Textbox)
Conferrer: Vijay Goyal, Mindfire Solutions.
12. Loading the Page...
- PreLoad (Non Recursive, End of Viewstate data load)
- Load (Top down approach, Previous State is fully loaded)
- RaisePostDataChangeEvent
(Controls implement
IpostBackDataHandler, TextChanged/SelectedIndexChanged)
- RaisePostBackEvent
click event)
- LoadComplete
(Controls implement IpostBackDataHandler,
(Page only)
Conferrer: Vijay Goyal, Mindfire Solutions
13. Page Rendering
- PreRender
(Recursive, Last update before the page is rendered)
- PreRenderComplete
view state is saved.)
(last event before the page's
- SaveControlState
- SaveViewState
(Control/Viewstate data are serialized to _VIEWSTATE)
- Render and Unload
(Renders the html to Client, Final Cleanup,closing
db, finishing up logging..etc)
Conferrer: Vijay Goyal, Mindfire Solutions
15. Dynamically Added Controls
- They are not part of the compiled class
- Should be added in every page execution
- Plays catchup
(go thru all the page life cycle events of their own, Before
Page Render)
- Recommended to call in PreInit or Init, before tracking is
enabled
Conferrer: Vijay Goyal, Mindfire Solutions