Add form runat=server tags in Composite Control

Discussion in 'ASP .Net Building Controls' started by DC, Dec 13, 2005.

  1. DC

    DC Guest

    Hi,

    I am using a Composite Control that encloses two Usercontrols. Both
    Usercontrols require to be enclosed in a <form runat=server> tag.

    I would like to add this tag within the Composite control (I cannot add
    the form tag in the aspx page or elsewhere).

    Question: how do I correctly render out the form tag? I tried adding
    the form tag in CreateChildControls() (where I also add the
    usercontrols to the composit control) but failed.

    TIA for any hint,

    Regards
    DC
    DC, Dec 13, 2005
    #1
    1. Advertising

  2. I think you should inherit your composite web control from HtmlForm.

    "DC" <> escribió en el mensaje
    news:...
    > Hi,
    >
    > I am using a Composite Control that encloses two Usercontrols. Both
    > Usercontrols require to be enclosed in a <form runat=server> tag.
    >
    > I would like to add this tag within the Composite control (I cannot add
    > the form tag in the aspx page or elsewhere).
    >
    > Question: how do I correctly render out the form tag? I tried adding
    > the form tag in CreateChildControls() (where I also add the
    > usercontrols to the composit control) but failed.
    >
    > TIA for any hint,
    >
    > Regards
    > DC
    >
    Jesús López, Dec 13, 2005
    #2
    1. Advertising

  3. DC

    DC Guest

    Thanks, I only need to add the UserControls to the control enumeration
    of the HtmlForm:

    Control myForm = new HtmlForm();
    Controls.Add(myForm);
    [...]
    myForm.Controls.Add(myUserControl);

    Regards
    DC
    DC, Dec 14, 2005
    #3
    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. z. f.
    Replies:
    1
    Views:
    461
    Mikhail Arkhipov \(MSFT\)
    Jun 25, 2004
  2. =?Utf-8?B?d3J5dGF0?=

    form in a form that runat server?

    =?Utf-8?B?d3J5dGF0?=, Jun 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    412
    Steve C. Orr [MVP, MCSD]
    Jun 7, 2005
  3. Replies:
    0
    Views:
    2,040
  4. Chad
    Replies:
    0
    Views:
    209
  5. dp_foster

    Form Tags and Runat=Server

    dp_foster, Jul 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    137
Loading...

Share This Page