473,505 Members | 14,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is CreateChildControls automatically called within an object OnInit?

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

TIA
Nov 18 '05 #1
4 1688
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" <de*********@yahoo.com> wrote in message
news:-b********************@giganews.com...
If not is it appropriate to place an EnsureChildControls within an objects
OnInit method?

TIA

Nov 18 '05 #2
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" <de*********@yahoo.com> wrote in message
news:-b********************@giganews.com...
If not is it appropriate to place an EnsureChildControls within an objects
OnInit method?

TIA

Nov 18 '05 #3
dx
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" <uc*@ftc.gov> wrote in message
news:uE**************@TK2MSFTNGP10.phx.gbl...
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" <de*********@yahoo.com> wrote in message
news:-b********************@giganews.com...
If not is it appropriate to place an EnsureChildControls within an objects OnInit method?

TIA


Nov 18 '05 #4
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" <de*********@yahoo.com> wrote in message
news:TZ********************@giganews.com...
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" <uc*@ftc.gov> wrote in message
news:uE**************@TK2MSFTNGP10.phx.gbl...
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" <de*********@yahoo.com> wrote in message
news:-b********************@giganews.com...
If not is it appropriate to place an EnsureChildControls within an objects OnInit method?

TIA



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7705
by: Arulraja | last post by:
Hello, I have created 2 custom server controls, The parent custom control contains multiple child custom controls. The Child control has a button on it. If I Click the button control, it...
0
899
by: DesignerX | last post by:
I have several custom controls (which inherit from WebControl), I have overriden the RenderContents of one of the custom controls. Within the RenderContents function of this control (Control #1) I...
8
4264
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
7
2320
by: Sky | last post by:
What I have currently: I have a user control called mod_container.aspx that is basically two divs -- the top a toolbar, that expands/collapse the second div which can contain other...
4
1294
by: dx | last post by:
If not is it appropriate to place an EnsureChildControls within an objects OnInit method? TIA
0
1484
by: Ferret | last post by:
I've found what seems to be a nasty bug in the DataGrid and Repeater classes. If CreateChildControls gets called before LoadViewState, ViewState fails to map and you end up with nothing on a...
2
2787
by: Michael | last post by:
Hi, I need to access view state data in my CreateChildControls method. Is there anyway to achieve that? I'm using ASP.NET 1.1. Thanks.
1
7036
by: Michael | last post by:
Hi, I'm coding a custom server control, and CreateChildControls() is giving me some pain. I'm just wondering why we have CreateChildControls(), and why this methods seems to be called at...
5
7237
by: Mark Olbert | last post by:
Tonight's episode of me beating my head bloody against the monitor was the result of ViewState/ControlState information not being available when CreateChildControls() gets called for a...
0
1582
by: Louis Somers | last post by:
Hi, I have a simple ASPX page called Default.aspx. On it (nested within allot of other stuff) I have a custom control which inherits from TableRow and implements IPostBackEventHandler. This...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.