Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - is CreateChildControls automatically called within an object OnInit?

 
Thread Tools Search this Thread
Old 04-08-2004, 06:34 PM   #1
Default is CreateChildControls automatically called within an object OnInit?


If not is it appropriate to place an EnsureChildControls within an objects
OnInit method?

TIA




dx
  Reply With Quote
Old 04-08-2004, 06:59 PM   #2
Kevin Spencer
 
Posts: n/a
Default Re: is CreateChildControls automatically called within an object OnInit?
Not unless the object is a Composite ASP.Net Server Control.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"dx" <> wrote in message
news:-bKdnRIuWsyLEOjdRVn-...
> If not is it appropriate to place an EnsureChildControls within an objects
> OnInit method?
>
> TIA
>
>





Kevin Spencer
  Reply With Quote
Old 04-08-2004, 08:02 PM   #3
Teemu Keiski
 
Posts: n/a
Default Re: is CreateChildControls automatically called within an object OnInit?
On initial request (non-postback) EnsureChildControls is called at PreRender
stage of the Page. At postback it is called when postback data handling for
the first control occurs, that is when FindControl is called which
automatically invokes EnsureChildControls first. This happens before
Page_Load at first postback data processing stage.

Why would you need this?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"dx" <> wrote in message
news:-bKdnRIuWsyLEOjdRVn-...
If not is it appropriate to place an EnsureChildControls within an objects
OnInit method?

TIA





Teemu Keiski
  Reply With Quote
Old 04-08-2004, 09:11 PM   #4
dx
 
Posts: n/a
Default Re: is CreateChildControls automatically called within an object OnInit?
Thanks Kevin, I appreciate your response. I'm trying to follow you full
circle.. can u help me understand these related questions.

Does .NET identify the object as a composite asp.net server control because
CreateChildControls is overriden? or because the objects inherits from
webcontrol? If not, how does .NET know this object is a composite control?

And what kicks off the OnInit call for the composite control?

Thanks again,
stan


"Kevin Spencer" <> wrote in message
news:...
> Not unless the object is a Composite ASP.Net Server Control.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "dx" <> wrote in message
> news:-bKdnRIuWsyLEOjdRVn-...
> > If not is it appropriate to place an EnsureChildControls within an

objects
> > OnInit method?
> >
> > TIA
> >
> >

>
>





dx
  Reply With Quote
Old 04-10-2004, 09:03 AM   #5
Teemu Keiski
 
Posts: n/a
Default Re: is CreateChildControls automatically called within an object OnInit?
Um...the pattern to build a composite control is that it overrides
CreateChildControls as well as implements INamingContainer marker interface
to outcome naming conflicts as well as guide in postback processing. There's
not such step as 'recognize' composite control, but rather there are these
steps that composite controls usually follow.

Article about composite controls:
http://aspalliance.com/359

OnInit method is part of general control lifecycle which is called when
control reaches initialization stage, true task of OnInit method is to raise
Init event. See resources about control lifecycle in this blog posts:
http://weblogs.asp.net/eporter/archi.../15/10109.aspx

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"dx" <> wrote in message
news:TZidnfqHuPCQL-jdRVn-...
Thanks Kevin, I appreciate your response. I'm trying to follow you full
circle.. can u help me understand these related questions.

Does .NET identify the object as a composite asp.net server control because
CreateChildControls is overriden? or because the objects inherits from
webcontrol? If not, how does .NET know this object is a composite control?

And what kicks off the OnInit call for the composite control?

Thanks again,
stan


"Kevin Spencer" <> wrote in message
news:...
> Not unless the object is a Composite ASP.Net Server Control.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "dx" <> wrote in message
> news:-bKdnRIuWsyLEOjdRVn-...
> > If not is it appropriate to place an EnsureChildControls within an

objects
> > OnInit method?
> >
> > TIA
> >
> >

>
>






Teemu Keiski
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46