[Mono-devel-list] ASP.NET Page Life Cycle || Bug ?

Matthew Metnetsky met at uberstats.com
Fri Aug 20 10:39:58 EDT 2004


I have been trying to figure out the page life cycle and am stumped by
what seems like a bug in .NET (not just Mono).

The end of this email has the basic life cycle as printed out via
Response.Write methods within a page, and a control.  I cannot seem to
figure out why on a Control level Postback the CreateChildControls()
method is called 3rd (which defines the HTML we'll see), while on any
other Postback its after the Page.PreRender().  This would keep any
Control Events from managing the data that needs to be printed
CreateChildControls().

How has anyone else dealt with this?  This sure seems like a bug to me,
any opinions?  Its very possible I'm just missing something, but this
seems counter-intuitive from every article on Page Life Cycle that I've
read.  I have tested this on Windows/.NET and Linux/Mono and I get the
same results.  My silly little test case is attached.

Simply put, I really need a control event to change an array list that
contains controls that get added during CreateChildControls(), but this
seems impossible with the current design.

~ Matthew

======================================

Page (first time):

Page.OnInit() 
Page.OnLoad() 
Control.OnLoad() 
Page.PreRender() 
Control.CreateChildControls() 

======================================

Page after Page Button Event:

Control.OnInit() 
Page.OnInit() 
Page.OnLoad() 
Control.OnLoad() 
Page.PageLabelClick() Event 
Page.PreRender() 
Control.CreateChildControls() 

======================================

Page After Control Button Event:

Control.OnInit() 
Page.OnInit() 
Control.CreateChildControls() 
Page.OnLoad() 
Control.OnLoad() 
Control.ControlBtnClick() Event 
Page.PreRender() 

======================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: page-life-cycle.zip
Type: application/zip
Size: 2982 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040820/1929d28a/attachment.zip 


More information about the Mono-devel-list mailing list