Custom Control with Child Controls

Discussion in 'ASP .Net Web Controls' started by Nitin, Oct 11, 2003.

  1. Nitin

    Nitin Guest

    Hi,

    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 />
    </myCtrl:MyControl>

    Now I want to render the output in the following manner :
    <TABLE>
    <TR>
    <TD>A</TD>
    </TR>
    <TR>
    <TD>B</TD>
    </TR>
    </TABLE>

    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 asp.net controls such as :

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

    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>
    End
    </a>

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

    Kindly help.

    Regards,
    Nitin
     
    Nitin, Oct 11, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Rodriguez
    Replies:
    23
    Views:
    1,182
    David Schwartz
    Dec 9, 2003
  2. Chad Scharf
    Replies:
    3
    Views:
    934
    Chad Scharf
    Oct 18, 2007
  3. Replies:
    0
    Views:
    217
  4. Replies:
    1
    Views:
    189
    Teemu Keiski
    Dec 8, 2005
  5. Replies:
    1
    Views:
    196
    Teemu Keiski
    Dec 8, 2005
Loading...

Share This Page