473,549 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the purpose of CreateChildCont rols()?

Hi,

I'm coding a custom server control, and CreateChildCont rols() is giving me
some pain. I'm just wondering why we have CreateChildCont rols(), 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 CreateChildCont rols() is being executed before my Load event. But
for post back, my Load event executes before my CreateChildCont rols().

I suppose calling EnsureChildCont rols() will call CreateChildCont rols() if
it has not already been called. But why all this complication? I'm even
thinking about creating my controls in the constructor instead of inside
CreateChildCont rols(); at least this way I know that my controls will have
been created when I need to use them.
Jun 7 '06 #1
1 7038
Hi Michael,

Here's a good reference for this:

http://msdn.microsoft.com/library/de...nLifecycle.asp

At the bottom, there is a note:

"The CreateChildCont rols method is not listed in the table because it is
called whenever the ASP.NET page framework needs to create the controls tree
and this method call is not limited to a specific phase in a control's
lifecycle. For example, CreateChildCont rols can be invoked when loading a
page, during data binding, or during rendering."

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.

"Michael" <mi*****@somewh ere.com> wrote in message
news:Ou******** ******@TK2MSFTN GP05.phx.gbl...
Hi,

I'm coding a custom server control, and CreateChildCont rols() is giving me
some pain. I'm just wondering why we have CreateChildCont rols(), 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 CreateChildCont rols() is being executed before my Load
event. But for post back, my Load event executes before my
CreateChildCont rols().

I suppose calling EnsureChildCont rols() will call CreateChildCont rols() if
it has not already been called. But why all this complication? I'm even
thinking about creating my controls in the constructor instead of inside
CreateChildCont rols(); at least this way I know that my controls will have
been created when I need to use them.

Jun 8 '06 #2

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

Similar topics

14
2096
by: Mudge | last post by:
This thread is hereby dubbed PHP Purpose, or PHPP. It has the following purposes: 1. To bring together PHPers and programmers around the world to become organized. 2. To dicuss purposes of programmers as relates to motives for programming. 3. To dicuss purposes of PHP itself and related technologies.
3
1832
by: yongbl | last post by:
Hi, I need to do a client-server project that involves TCP/IP and XML. I want to make it a meaningful project. My friends suggested doing a project on Web Service. What kind of web services should I do? Any suggestions? Thanks in advance, Yong
24
7637
by: Hardy | last post by:
I'm pretty new in this field. when reading some 70x material, I met with this term but cannot catch its accurate meaning. who can help me? thanks in advance:)~
5
8170
by: rahul8143 | last post by:
hello, I want to know for what purpose union REGS and struct SREGS are used in windows programming? also how following code an determine that running OS is windows? in_regs.x.ax = 0x160A; int86x(0x2F, &in_regs, &out_regs, &seg_regs); if (out_regs.x.ax == 0) Running_WIN=TRUE; provided here union REGS in_regs, out_regs;
6
6067
by: John Salerno | last post by:
I understand how they work (basically), but I think maybe the examples I'm reading are too elementary to really show their value. Here's one from Programming C#: #region Using directives using System; using System.Collections.Generic; using System.Text;
11
2529
by: z | last post by:
How can validation testing on DBMSs such as DB2 and Oracle be performed? Is there a quick commonly used publicly available DBMS test that can be used? Could TPC-C be used? If so, where can TPC-C be obtained? (Is is publicly available?) Thanks.
4
1873
by: Harro de Jong | last post by:
(absolute beginner here, sorry if this seems basic) Section 7.10 of 'How to Think Like a Computer Scientist' contains this discussion of string.find and other string functions: (quote) We can use these constants and find to classify characters. For example, if find(lowercase, ch) returns a value other than -1, then ch must be lowercase: ...
5
20930
by: vapour | last post by:
Hi, Quick question here, and wondering if anyone can help. I often see the hash character ('#') in regular expressions and am wondering what purpose it is supposed to serve. Example: #(?<=|^) Every bit of online documentation I have looked at states the hash character's purpose is merely to denote the line is a comment. Clearly this is...
2
33687
by: Sam Bendayan | last post by:
Greetings, What is the point of Microsoft defining a ROWGUIDCOL property that can be attached to a 'uniqueidentifier' column? This is defined as a column that is 'globally unique', but doesn't the uniqueidentifier datatype already guarantee that? To make matters more confusing, they tell you in Books Online to add a Unique constraint...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
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. ...
1
7470
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
7809
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
6041
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
5088
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
3498
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
1936
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 we have to send another system
0
763
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.