473,809 Members | 2,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ParseChildren(f alse) not adding sub objects in the designer

I have been wrestling with this code for about 2 weeks now. My goal is to
create a table for formatting purposes. I want to standardize it as a
webcontrol. I want all of the content to persist as top-level controls so
that they are visible to the asp.net designer -- PersistChildren (true). The
code works fine for run-time, but will not call AddParsedSubObj ect for
design-time. If the content is literal only, it will add the parsed sub
object "LiteralContent ", but if I add any other controls it does not
display.

How do I get my child controls to display properly in the asp.net designer?

Thanks to any who can help!
Sam Fields
Here is a sample of what I am trying to build in its simplest format:

c# code:
namespace testbed
{
[ParseChildren(f alse), PersistChildren (true)]
[ToolboxData("<{ 0}:test runat=server></{0}:test>")]
public class test : Table
{
private TableCell innercell = new TableCell();
public test()
{
this.Rows.Add(n ew TableRow());
this.Rows[0].Cells.Add(new TableCell());
this.Rows[0].Cells[0].Text = "Header";

this.Rows.Add(n ew TableRow());
this.Rows[1].Cells.Add(inne rcell);

this.Rows.Add(n ew TableRow());
this.Rows[2].Cells.Add(new TableCell());
this.Rows[2].Cells[0].Text = "Footer";
}

protected override void AddParsedSubObj ect(object obj)
{
innercell.Contr ols.Add((Contro l) obj);
this.ChildContr olsCreated = false;
}
}
}

..aspx page:
<%@ Register TagPrefix="cc" Namespace="test bed" Assembly="testb ed" %>
<%@ Page language="c#" Codebehind="def ault.aspx.cs"
AutoEventWireup ="false"
Inherits="testb ed._default" %>
<HTML>
<HEAD>
<title>defaul t</title>
</HEAD>
<body>
<form id="default" method="post" runat="server">
<cc:test id="content" runat="server">
MyContent
<asp:Label id="mylabel" text="MyLabel" Runat="server"> </asp:Label>
</cc:test>
</form>
</body>
</HTML>

Nov 18 '05 #1
1 2106
Sam..

I'm afraid you are never going to achieve design time rendering of children
controls persisted with [ParseChildren(f alse)] [PersistChildren (true)].
First of - AddParsedSubObj ect method runs only at run-time. ControlBuilder' s
are the ones executed at parse time - they generate a tree similar to
control tree but containing instances of ControlBuilders . Nevertheless I
would recommend to implement ITemplate interface and
TemplatedContro lDesigner for control.

Regards

Radek

"Sam Fields" <sf*****@state. pa.us> wrote in message
news:Ob******** *****@TK2MSFTNG P12.phx.gbl...
I have been wrestling with this code for about 2 weeks now. My goal is to
create a table for formatting purposes. I want to standardize it as a
webcontrol. I want all of the content to persist as top-level controls so
that they are visible to the asp.net designer -- PersistChildren (true). The code works fine for run-time, but will not call AddParsedSubObj ect for
design-time. If the content is literal only, it will add the parsed sub
object "LiteralContent ", but if I add any other controls it does not
display.

How do I get my child controls to display properly in the asp.net designer?
Thanks to any who can help!
Sam Fields
Here is a sample of what I am trying to build in its simplest format:

c# code:
namespace testbed
{
[ParseChildren(f alse), PersistChildren (true)]
[ToolboxData("<{ 0}:test runat=server></{0}:test>")]
public class test : Table
{
private TableCell innercell = new TableCell();
public test()
{
this.Rows.Add(n ew TableRow());
this.Rows[0].Cells.Add(new TableCell());
this.Rows[0].Cells[0].Text = "Header";

this.Rows.Add(n ew TableRow());
this.Rows[1].Cells.Add(inne rcell);

this.Rows.Add(n ew TableRow());
this.Rows[2].Cells.Add(new TableCell());
this.Rows[2].Cells[0].Text = "Footer";
}

protected override void AddParsedSubObj ect(object obj)
{
innercell.Contr ols.Add((Contro l) obj);
this.ChildContr olsCreated = false;
}
}
}

.aspx page:
<%@ Register TagPrefix="cc" Namespace="test bed" Assembly="testb ed" %>
<%@ Page language="c#" Codebehind="def ault.aspx.cs"
AutoEventWireup ="false"
Inherits="testb ed._default" %>
<HTML>
<HEAD>
<title>defaul t</title>
</HEAD>
<body>
<form id="default" method="post" runat="server">
<cc:test id="content" runat="server">
MyContent
<asp:Label id="mylabel" text="MyLabel" Runat="server"> </asp:Label>
</cc:test>
</form>
</body>
</HTML>


Nov 18 '05 #2

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

Similar topics

0
1935
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a button that prevents the user from submitting a form back multiple times and also prevents them from submitting the form and then clicking something else before the postback can finish processing. What I have is a working button that disables...
19
2992
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
4
2523
by: Rob Meade | last post by:
Hi all, I have just put together our organisations 'template' for our web applications and have created 7 .ascx files which when dropped into my template file work perfectly...however, I have a question... As our team develops several applications I wanted these generic .ascx's to be able to be used by all - therefore I've placed them in the root of the domain we work on in a directory called /WebUserControls
0
1071
by: Emil Stoev | last post by:
Howdy eXperts! I have this problem w/ my ASP.NET control. The control is a menu with the following structure: Menu Group 1 Item 1 Item 2 Item 3
3
1054
by: 00_CuMPe3WaR3D12 | last post by:
How do I write a user control that takes HTML and then renders it? Is it possible? I want to do something like this.. <Name:Box id="mybox" runat="server"> <table> .... any html can inserted in here.... </table> </Name:Box>
3
1869
by: Chris Newby | last post by:
I have a very simple custom control that derives from WebControls.Panel and implements INamingContainer. It appear that controls created as children of my custom control are having ViewState problems. For example, suppose I create a ListBox control as a child of my custom control, attach a SelectedIndexChanged event handler to it, and bind its data in the Page_Load event handler only if the current request is not a post back. I load the...
0
891
by: Umut Tezduyar | last post by:
I have build a sample control but the designer doesn't communicate with it to parse the childen property. Please if you are an control developer, spend your 10 minutes to solve my problem. I have read so many articles and books to solve it but i couldn't. Here is the code sample: ---------- Asp Page ---------------- <form id="Form1" method="post" runat="server">
0
1007
by: Umut Tezduyar | last post by:
I have build a sample control but the designer doesn't communicate it to parse the childen. Please if you are an control developer, spend your 10 minutes to solve my problem. The main problem is, whenever i made a change in the sub object (Tab) it doesn't persist the changes to the asp.net page. Here is the code sample: ---------- Asp Page ----------------
0
3269
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design time. If I type the code in the aspx manually it does get parsed correctly though. This is an example of the aspx code that gets parsed correctly. For some reason, if I changed update the Tab property of the control through the GUI at design...
0
9721
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10639
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
10376
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10120
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
9200
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...
0
6881
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
5550
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...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3015
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.