Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Custom Control with Child Controls

Thread Tools

Custom Control with Child Controls

Posts: n/a

I have created 2 custom control : MyControl and C1
I have following tags in my aspx file :
<myCtrl:MyControl runat=server>
<myCtrl:C1 Text="A" runat=server />
<myCtrl:C1 Text="B" runat=server />

Now I want to render the output in the following manner :

Custom control C1 will render each row (<tr>) which I am
able to do by having a property named "Text" inside C1 and
overriding the Render method.

Custom control MyControl should start a Table and also end
the table when all the child controls are rendered.

I am not able to close the table after all the child
controls are rendered.
I tried having a Custom ControlBuilder Class and
overriding some methods but that is also not working.

This thing works with controls such as :

<asp:LinkButton ID="lb1" Runat=server>
LinkButton <br>
<asp:Label ID="l1" Runat=server>one</asp:Label>
<asp:Label ID="l2" Runat=server>two</asp:Label>

The output when I see source :

<a id="lb1" href="javascript:__doPostBack('lb1','')">
LinkButton <br>
<span id="l1">one</span><br>
<span id="l2">two</span><br>

My problem in my control is how to get this last "</a>"

Kindly help.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
this.Controls.Add(Control) Does Not Add Control to child collection (this.Controls.Count == 0) Chad Scharf ASP .Net 3 10-18-2007 03:53 PM
Control.Controls bug? Control's child controls missing at the run time. ASP .Net Building Controls 1 12-08-2005 06:47 AM
Control.Controls bug? Control's child controls missing at the run time. ASP .Net Web Controls 1 12-08-2005 06:46 AM
HELP! Child controls of child controls not visible to web app ASP .Net Building Controls 0 05-05-2005 09:14 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM