positioning dynamically created controls

Discussion in 'ASP .Net' started by Smokey Grindel, Oct 4, 2006.

  1. I have a web control library that of course renders custom html... I want to
    place what it outputs into a div on the page.. how do I tell it to place
    this dynamically created custom control into a div? so its placed in the
    correct location on the form? thanks!
    Smokey Grindel, Oct 4, 2006
    #1
    1. Advertising

  2. You need to put a placeholder control inside your <div>, then
    dynamically add your web control to the placeholder.

    <asp:placeHolder id="PlaceHolder1" runat="server"/>

    PlaceHolder1.Controls.Add(myWebControl);

    More info here:
    http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.placeholder.aspx

    Smokey Grindel wrote:
    > I have a web control library that of course renders custom html... I want to
    > place what it outputs into a div on the page.. how do I tell it to place
    > this dynamically created custom control into a div? so its placed in the
    > correct location on the form? thanks!
    Chris Fulstow, Oct 4, 2006
    #2
    1. Advertising

  3. ah thank you! didnt think it was so simple... or maybe im just getting
    old...

    "Chris Fulstow" <> wrote in message
    news:...
    > You need to put a placeholder control inside your <div>, then
    > dynamically add your web control to the placeholder.
    >
    > <asp:placeHolder id="PlaceHolder1" runat="server"/>
    >
    > PlaceHolder1.Controls.Add(myWebControl);
    >
    > More info here:
    > http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.placeholder.aspx
    >
    > Smokey Grindel wrote:
    >> I have a web control library that of course renders custom html... I want
    >> to
    >> place what it outputs into a div on the page.. how do I tell it to place
    >> this dynamically created custom control into a div? so its placed in the
    >> correct location on the form? thanks!

    >
    Smokey Grindel, Oct 4, 2006
    #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. Harry
    Replies:
    1
    Views:
    1,670
    Natty Gur
    Jun 25, 2003
  2. Bryan Donaldson
    Replies:
    0
    Views:
    428
    Bryan Donaldson
    Nov 24, 2003
  3. Brian Smith
    Replies:
    4
    Views:
    714
    Brian Smith
    Jan 9, 2004
  4. msimmons
    Replies:
    0
    Views:
    472
    msimmons
    Jul 16, 2009
  5. Guy

    Positioning dynamically created controls

    Guy, Dec 22, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    233
    Mohamed El Ashmawy
    Dec 23, 2004
Loading...

Share This Page