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

Home Posts Topics Members FAQ

Dynamic Composite Controls And Their Child Control Collection

Hello,
I have a composite WebControl that I'm dynamically instantiating at
runtime using Reflection. When I create a new instance of my control I
immediately iterate through it's child control collection (it has
about 4 child controls). The problem is none of these controls are
loaded or accessible when I create the instance since, I believe, they
are created by the server at a later point in time. How could I force
my composite control to load its child controls so I can perform my
iteration?

I don't have this problem when dealing with UserControls as the
LoadControl method creates a new instance of the UserControl and loads
all of it's associated child controls in its control collection.
- Harry
Nov 18 '05 #1
2 1849
your composite controls needs to call EnsureChildCont rols. this will force a
call CreateChildCont rols.

-- bruce (sqlwork.com)


"Harry" <ro******@vu.un ion.edu> wrote in message
news:16******** *************** ***@posting.goo gle.com...
Hello,
I have a composite WebControl that I'm dynamically instantiating at
runtime using Reflection. When I create a new instance of my control I
immediately iterate through it's child control collection (it has
about 4 child controls). The problem is none of these controls are
loaded or accessible when I create the instance since, I believe, they
are created by the server at a later point in time. How could I force
my composite control to load its child controls so I can perform my
iteration?

I don't have this problem when dealing with UserControls as the
LoadControl method creates a new instance of the UserControl and loads
all of it's associated child controls in its control collection.
- Harry

Nov 18 '05 #2
Bruce,
How would I go about doing this? I ahve tried calling the method
this.EnsureChil dControls() in my composite WebControl's constructor,
but this doesn't work.

- Harry
"bruce barker" <no***********@ safeco.com> wrote in message news:<#8******* *******@TK2MSFT NGP11.phx.gbl>. ..
your composite controls needs to call EnsureChildCont rols. this will force a
call CreateChildCont rols.

-- bruce (sqlwork.com)


"Harry" <ro******@vu.un ion.edu> wrote in message
news:16******** *************** ***@posting.goo gle.com...
Hello,
I have a composite WebControl that I'm dynamically instantiating at
runtime using Reflection. When I create a new instance of my control I
immediately iterate through it's child control collection (it has
about 4 child controls). The problem is none of these controls are
loaded or accessible when I create the instance since, I believe, they
are created by the server at a later point in time. How could I force
my composite control to load its child controls so I can perform my
iteration?

I don't have this problem when dealing with UserControls as the
LoadControl method creates a new instance of the UserControl and loads
all of it's associated child controls in its control collection.
- Harry

Nov 18 '05 #3

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

Similar topics

0
1634
by: Phil S. | last post by:
I'm having dreadful trouble putting a simple composite control into the DataGrid cell, so I'm hoping someone might have stumbled across this problem before and have some advice. My composite control is a date picker which contains a couple of basic text, drop down and image button controls. My control follows the composite design guidelines carefully and behaves perfectly when used on a web page. It uses ViewState and gets events from is...
3
3039
by: David Whitney | last post by:
All: I have a control that renders a table. As the table is rendered, each row in the table is constructed by creating a run-time (dynamic) object that is derived from an HtmlTableRow. The row has three HtmlTableCell objects, and each cell contains a single control added to the HtmlTableCell's Controls collection. The basic table renders correctly, but the controls within the HtmlTableCell objects do not; the cells are just empty. (Just...
1
3151
by: sleigh | last post by:
Hello, I'm building a web application that will build a dynamic form based upon questions in a database. This form will have several different sections that consist of a panel containing one to many questions. To keep it simple, I'll describe the basics of what I'm trying to design. I've created a TextBox composite control that consists of a label for
10
2321
by: dx | last post by:
I have the Microsoft Press: Developing Microsoft ASP.NET Server Controls and Components book. It's starting to shine some light on control development but there is something about composite controls that I don't understand... I've included a snippet from Chapter 12 below on Composite Controls: <start> Override the CreateChildControls method to instantiate child controls, initialize them, and add them to the control tree. Do not perform...
2
1816
by: Harry | last post by:
Hello, I have a composite WebControl that I'm dynamically instantiating at runtime using Reflection. When I create a new instance of my control I immediately iterate through it's child control collection (it has about 4 child controls). The problem is none of these controls are loaded or accessible when I create the instance since, I believe, they are created by the server at a later point in time. How could I force my composite control...
1
1978
by: Mark Olbert | last post by:
I have a "master" composite control which, in turn, holds an instance of a "detail" composite control (the "master" control will ultimately contain multiple instances of the "detail" control, but I'm keeping things simple to try and figure out what's going wrong). The master control supports databinding. Upon postback, the detail control is not retrieving its state from ViewState after it is created and added to the master control during...
6
2632
by: shapper | last post by:
Hello, I am working in a class library with various custom controls. In which cases should a control inherit Control, WebControl and CompositeControl classes? And when should a custom control implement INamingContainer? In this moment I am working on a custom control that is composed by a
0
9287
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10046
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9722
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8723
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6542
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5155
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.