473,569 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is CreateChildCont rols automatically called within an object OnInit?

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

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

TIA

Nov 18 '05 #2
On initial request (non-postback) EnsureChildCont rols 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 EnsureChildCont rols 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*********@ya hoo.com> wrote in message
news:-b************** ******@giganews .com...
If not is it appropriate to place an EnsureChildCont rols 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
CreateChildCont rols 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******** ******@TK2MSFTN GP10.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*********@ya hoo.com> wrote in message
news:-b************** ******@giganews .com...
If not is it appropriate to place an EnsureChildCont rols within an objects OnInit method?

TIA


Nov 18 '05 #4
Um...the pattern to build a composite control is that it overrides
CreateChildCont rols as well as implements INamingContaine r 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*********@ya hoo.com> wrote in message
news:TZ******** ************@gi ganews.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
CreateChildCont rols 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******** ******@TK2MSFTN GP10.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*********@ya hoo.com> wrote in message
news:-b************** ******@giganews .com...
If not is it appropriate to place an EnsureChildCont rols 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
7710
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 calls the Parent controls CreateChildControls() method before calling the child control's button click event. Because of this behaviour, I am not...
0
902
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 instantiate a different custom control (Control #2) and call it's RenderControl function. The CreateChildContents of Control #2 is never executed. I...
8
4267
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 which is related to the repeater. In the code shown below, if I call Repeater1.Controls.Count in the OnInit (the code fragment was highlighted in...
7
2324
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 modules/controls (eg a newsfeed, quick phonelist, login, etc.) But the controls end up too 'deep': it appears that it would be lighter/better if I could just...
4
1693
by: dx | last post by:
If not is it appropriate to place an EnsureChildControls within an objects OnInit method? TIA
0
1490
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 Postback. Please try the following test, and let me know if you can reproduce this: - Create a custom DataGrid or Repeater class that does nothing but...
2
2791
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
7042
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 different times in the page lifecycle. I mean the order it is called is not deterministic. Example if not post back, then my CreateChildControls() is being...
5
7245
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 CompositeControl. So, my question is, >>why<< isn't ViewState/ControlState available before CreateChildControls() gets called by the Framework? Is it just me,...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.