To customize control behavior in this phase, override the
OnLoad method.
PreRender Event
The PreRender event is a phase in the control life cycle that represents the last-ditch chance for
a control to do something before it is rendered. This is the location to put code that must
execute before rendering but after the Load event, state management methods, and postback
events have occurred. Controls can override the OnPreRender method for this special situation.
Note that changes made to a control??™s state at this point in the life cycle will persist to
ViewState.
SaveViewState Method
The SaveViewState method saves the ViewState dictionary by default without any additional
action by you. Overriding this method is only necessary when a control needs to customize
state persistence in ViewState. This method is called only when the EnableViewState property
inherited from Control is set to true. The object instance that is returned from this method is
serialized by ASP.NET into the final ViewState string that is emitted into the page??™s __VIEWSTATE
hidden field. Be aware that SaveViewState is called twice in our sample code as a result of
enabling page tracing, which makes a call to SaveViewState to gather information for tracing
purposes.
Pages:
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351