F
foldface
Hi
I'm trying to find the EXACT order of lifecycle calls for web pages
and
webcontrols.
I created a control that inherits from Button but has LifeCycle
print statements in it, e.g.
protected override void TrackViewState()
{
base.TrackViewState();
Page.Trace.Write(this.ID, "In TrackViewState...");
}
I created a web page that has this control on it, plus a UserControl
that holds nothing but this control.
I also put trace statments on the web page. The results are shown
below,
Note that:
Level2 - Contol on the UserControl
Level1 - Control on the web page
<blank> the web page
aspx.page Begin Init
Level1 In Init... 0.004872 0.004872
Level1 In TrackViewState... 0.006841 0.001968
Level2 In Init... 0.006949 0.000108
Level2 In TrackViewState... 0.006987 0.000038
In Init... 0.011638 0.004651
In TrackViewState... 0.012232 0.000594
aspx.page End Init 0.012295 0.000063
In Load... 0.014985 0.002690
Level1 In Load... 0.015653 0.000668
Level2 In Load... 0.015974 0.000321
aspx.page Begin PreRender 0.016031 0.000058
In PreRender... 0.018502 0.002471
Level1 In PreRender... 0.019241 0.000739
Level2 In PreRender... 0.019311 0.000071
aspx.page End PreRender 0.019351 0.000039
In SaveViewState... 0.021690 0.002339
Level1 In SaveViewState... 0.041467 0.019777
Level2 In SaveViewState... 0.043344 0.001877
aspx.page Begin SaveViewState 0.043958 0.000614
In SaveViewState... 0.065334 0.021376
Level1 In SaveViewState... 0.065457 0.000123
Level2 In SaveViewState... 0.065503 0.000046
aspx.page End SaveViewState 0.065707 0.000204
aspx.page Begin Render 0.065758 0.000052
Level1 In Render... 0.444391 0.378633
Level2 In Render... 0.444745 0.000353
In Render... 0.447510 0.002765
aspx.page End Render 0.447620 0.000111
Results:
- Note that for InInit and Render the parent is called last, which
is what I would expect, for Load, PreRender and SaveViewState the
parent is called first.
I want to know the exact order of initialisation with regard to
controls
on web pages and parent/child relations. Where can I find this info,
I was personally expecting the parent to be called last for all
methods
and was quite surprised by this.
Thanks for any replies
F
I'm trying to find the EXACT order of lifecycle calls for web pages
and
webcontrols.
I created a control that inherits from Button but has LifeCycle
print statements in it, e.g.
protected override void TrackViewState()
{
base.TrackViewState();
Page.Trace.Write(this.ID, "In TrackViewState...");
}
I created a web page that has this control on it, plus a UserControl
that holds nothing but this control.
I also put trace statments on the web page. The results are shown
below,
Note that:
Level2 - Contol on the UserControl
Level1 - Control on the web page
<blank> the web page
aspx.page Begin Init
Level1 In Init... 0.004872 0.004872
Level1 In TrackViewState... 0.006841 0.001968
Level2 In Init... 0.006949 0.000108
Level2 In TrackViewState... 0.006987 0.000038
In Init... 0.011638 0.004651
In TrackViewState... 0.012232 0.000594
aspx.page End Init 0.012295 0.000063
In Load... 0.014985 0.002690
Level1 In Load... 0.015653 0.000668
Level2 In Load... 0.015974 0.000321
aspx.page Begin PreRender 0.016031 0.000058
In PreRender... 0.018502 0.002471
Level1 In PreRender... 0.019241 0.000739
Level2 In PreRender... 0.019311 0.000071
aspx.page End PreRender 0.019351 0.000039
In SaveViewState... 0.021690 0.002339
Level1 In SaveViewState... 0.041467 0.019777
Level2 In SaveViewState... 0.043344 0.001877
aspx.page Begin SaveViewState 0.043958 0.000614
In SaveViewState... 0.065334 0.021376
Level1 In SaveViewState... 0.065457 0.000123
Level2 In SaveViewState... 0.065503 0.000046
aspx.page End SaveViewState 0.065707 0.000204
aspx.page Begin Render 0.065758 0.000052
Level1 In Render... 0.444391 0.378633
Level2 In Render... 0.444745 0.000353
In Render... 0.447510 0.002765
aspx.page End Render 0.447620 0.000111
Results:
- Note that for InInit and Render the parent is called last, which
is what I would expect, for Load, PreRender and SaveViewState the
parent is called first.
I want to know the exact order of initialisation with regard to
controls
on web pages and parent/child relations. Where can I find this info,
I was personally expecting the parent to be called last for all
methods
and was quite surprised by this.
Thanks for any replies
F