GeneralPageLife-cycleStages
StagePagerequestDescriptionThepagerequestoccursbeforethepagelifecyclebegins.Whenthepageisrequestedbyauser,ASP.
NETdetermineswhetherthepageneedstobeparsedandcompiledorwhetheracachedversionofthepagecanbesentinresponsewithoutrunningthepage.Inthestartstep,pagepropertiessuchasRequestandResponseareset.Atthisstage,thepagealsodetermineswhethertherequestisapostbackoranewrequestandsetstheIsPostBackproperty.Additionally,duringthestartstep,thepage'sUICulturepropertyisset.Duringpageinitialization,controlsonthepageareavailableandeachcontrol'sUniqueIDpropertyisset.Anythemesareals
oappliedtothepage.Ifthecurrentrequestisapostback,thepostbackdatahasnotyetbeenloadedandcontrolpropertyvalueshavenotbeenrestoredtothevaluesfromviewstate.Duringload,ifthecurrentrequestisapostback,controlpropertiesareloadedwithinformationrecoveredfromviewstateandcontrolstate.Duringvalidation,theValidatemethodofallvalidatorcontrolsiscalled,whichsetstheIsValidpropertyofindividualvalidatorcontrolsandofthepage.Iftherequestisapostback,anyeventhandlersarecalled.LoadRenderingBeforerendering,viewstateissavedforthepageandallcontrols.Duringtherenderingphase,thepagecallstheRendermethodforeachcontrol,providingatextwriterthatwritesitsoutputtotheOutputStreamofthepage'sResponseproperty.ControleventsUnloadUnloadiscalledafterthepagehasbeenfullyrendered,senttotheclient,andisreadytobediscarded.Atthispoint,pagepropertiessuchasResponseandRequestareunloadedandanycleanupisperformed.LoadCompletePageEventPreInit
CommonLife-cycleEvents
TypicalUseUsethiseventforthefollowing:ChecktheIsPostBackpropertytodeterminewhetherthisisthefirsttimethepageisbein
gprocessed.Createorre-createdynamiccontrols.Setamasterpagedynamically.SettheThemepropertydynamically.Readorsetprofilepropertyvalues.Note:Iftherequestisapostback,thevaluesofthecontrolshavenotyetbeenrestoredfromviewstate.Ifyousetacontrolpropertyatthisstage,itsvaluemightbeoverwritteninthenextevent.Raisedafterallcontrolshavebeeninitializedandanyskinsettingshavebeenapplied.Usethiseventtoreadorinitializecontrolproperties.RaisedbythePageobject.Usethiseventforprocessingtasksthatrequireallinitializationbecomplete.UsethiseventifyouneedtoperformprocessingonyourpageorcontrolbeforetheLoadevent.AfterthePageraisesthisevent,itloadsviewstateforitselfandallcontrols,andthenprocessesanypostbackdataincludedwiththeRequestinstance.ThePagecallstheOnLoadeventmethodonthePage,thenrecursivelydoesthesameforeachchildcontrol,whichdoesthesameforeachofitschildcontrolsuntilthepageandallcontrolsareloaded.Usetheseeventstohandlespecificcontrolevents,suchasaB