M
multiformity
Ok, so I have gone off and documented the lifecycle of a page with a
custom composite control on it. You can find that document here:
http://www.ats-engineers.com/lifecycle.htm
Now, I am working on a much more complex grid example, and according to
my findings, the order should be like so:
Page Constructor
Page OnInit
Page OnLoad Enter
Page Instantiates Composite Control
Control Constructor Enter
Control Adds Button
Control Constructor Exit
Control OnInit
Page OnLoad Exit
Control OnLoad
Page PreRender
Page SaveViewState
Control SaveViewState
Control OnUnLoad
Page OnUnLoad
The document I linked to above shows the code that I used to produce
this output, and I have stepped through it multiple times to verify
that this order is true.
Now my problem is that in my MUCH more complex Custom Control, I watch
the code go from the controls constructor, to the pages OnPreRender
method, skipping the controls oninit and onload methods (which will
skip the LoadViewState method if it is a postback). There has gotta be
something simple wrong with my other composite control. However that
control is about 700 lines of code, and I don't expect anyone to go
through it, especially considering that it uses about 10 other custom
classes that I wrote.
So without me getting into too much detai, the question is what could
cause a controls oninit to not fire. This composite control inherits
from PlaceHolder, just like the example I site in my page I referred to
above, so that shouldn't be the problem. The control is being added to
the page just as in the above example as well. However, I am trying to
get it to load the view state, and those methods are never called
either, it's like it isn't a System.Web.Control at all...
Any ideas?
custom composite control on it. You can find that document here:
http://www.ats-engineers.com/lifecycle.htm
Now, I am working on a much more complex grid example, and according to
my findings, the order should be like so:
Page Constructor
Page OnInit
Page OnLoad Enter
Page Instantiates Composite Control
Control Constructor Enter
Control Adds Button
Control Constructor Exit
Control OnInit
Page OnLoad Exit
Control OnLoad
Page PreRender
Page SaveViewState
Control SaveViewState
Control OnUnLoad
Page OnUnLoad
The document I linked to above shows the code that I used to produce
this output, and I have stepped through it multiple times to verify
that this order is true.
Now my problem is that in my MUCH more complex Custom Control, I watch
the code go from the controls constructor, to the pages OnPreRender
method, skipping the controls oninit and onload methods (which will
skip the LoadViewState method if it is a postback). There has gotta be
something simple wrong with my other composite control. However that
control is about 700 lines of code, and I don't expect anyone to go
through it, especially considering that it uses about 10 other custom
classes that I wrote.
So without me getting into too much detai, the question is what could
cause a controls oninit to not fire. This composite control inherits
from PlaceHolder, just like the example I site in my page I referred to
above, so that shouldn't be the problem. The control is being added to
the page just as in the above example as well. However, I am trying to
get it to load the view state, and those methods are never called
either, it's like it isn't a System.Web.Control at all...
Any ideas?