"Alex" <a.*******@verizon.net> wrote in message
news:uC**************@TK2MSFTNGP10.phx.gbl...
I believe that when you instantiate a Control derived custom control that
implements the virtual method CreateChildControls(), that that base class
constructor in Control calls EnsureChildControls() which will invoke
CreateChildControls(). Am I correct?
No. This is very incorrect. If this were the case, there would be no need
for a separate EnsureChildControls, since they would always be there.
A piece of code calls EnsureChildControls whenever it requires that the
child controls be present. If nothing else, ASP.NET will call
EnsureChildControls at the beginning of the PreRender phase.
A piece of code which is changing things in such a way as to cause a change
in the set of child controls should set "ChildControlsCreated = false" so
that the next time that EnsureChildControls is called, CreateChildControls
will be called.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com