473,396 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Recommended way to add child controls in CreateChildControls

Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

Paul

Aug 3 '06 #1
1 1321
If I try to modify the Controls collection, I get a "The Controls
collection cannot be modified because the control contains code blocks"
error because my controls contain literal content (i.e. <%=
SomeValue%>). If I change the literal content to a <%# %tag it
doesn't get picked up and is rendered empty.

Is there any way to insert layout controls around the existing controls
and preserve the literal content?

Any help would be appreciated. I'm stuck on this one.

Thanks,

Paul

pa*********@gmail.com wrote:
Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

Paul
Aug 3 '06 #2

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

Similar topics

5
by: Jonathan Williams | last post by:
Hi, I have an object which inherits from WebControl (CUSTOM : WebControl) In this object I have code in which I add child contols: protected override void CreateChildControls() {...
3
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...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
1
by: Sally | last post by:
Just confused about when OnInit and Constructor gets called in the parent/child case. Page.Constructor() Page.AddParsedSubObject() <- do all the sub's constructors get called here?...
2
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...
2
by: Juan Romero | last post by:
Hey guys, I am working on a web custom control that basically draws a table (ASP Table) with a few child controls in the cells. I have a command button inside one of these cells. The problem I...
0
by: spacehopper_man | last post by:
hi - I am writing a "tab" control. - but it's losing the viewstate of the content pane when I switch between tabs. can anyone shed any light on why I'm losing ViewState based on my simple...
1
by: Paul | last post by:
Hi all, What is the recommended way to add child controls *around* existing child controls in the CreateChildControls method (e.g. table, row and cell controls for layout purposes)? Is the...
0
by: shapper | last post by:
Hello, I have a control with the following property: Private _Sections As New List(Of FormSection) Public Property Sections() As List(Of FormSection) Get If _Sections Is Nothing Then...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
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...
0
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
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,...

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.