place WebUserControl in X, Y location

Discussion in 'ASP .Net Building Controls' started by Dave Johnson, Dec 14, 2005.

  1. Dave Johnson

    Dave Johnson Guest

    i built nested UserControls, and the parent control dynamicly generate
    the child contorls, but i have a problem with positioning them on the
    control page, how is it done for WebUseControl, i am sure its very
    simple and basic Question but as i am new to usercontrols help will be
    very appreciated if given multiple ways if there is more than one way.

    thanks,


    Sharing makes All the Difference

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
     
    Dave Johnson, Dec 14, 2005
    #1
    1. Advertising

  2. Dave Johnson

    Daniel TIZON Guest

    Hi Dave,
    To place a WebUserControls dynamicaly on the page you should :
    - place a static Container Control, a <ASP:placeHolder> or a <ASP:panel>
    control on the page.
    - create an instance of the UserControl by using the LoadControl method
    MyUserControl MyUC =
    (MyUserControl)Page.LoadControl("WUC/MyUserControl.ascx");
    - pass the parameters
    MyUC.param1="hello";
    - Add the control to the controls collection of your container.
    MyPanel.Controls.add(MyUC);

    If you want to place the control to x,y coordonates, I advise to use the
    Panel as a container and to add Styles
    MyPanel.Style.Add("position","absolute");
    MyPanel.Style.Add("left","296px");
    MyPanel.Style.Add("top","159px");

    Hope this helps !

    --
    Daniel TIZON
    MCP - MCSD.NET - MCT


    "Dave Johnson" <> a écrit dans le message de news:
    ...
    >i built nested UserControls, and the parent control dynamicly generate
    > the child contorls, but i have a problem with positioning them on the
    > control page, how is it done for WebUseControl, i am sure its very
    > simple and basic Question but as i am new to usercontrols help will be
    > very appreciated if given multiple ways if there is more than one way.
    >
    > thanks,
    >
    >
    > Sharing makes All the Difference
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
     
    Daniel TIZON, Dec 16, 2005
    #2
    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. Luke Dalessandro
    Replies:
    0
    Views:
    632
    Luke Dalessandro
    Jan 15, 2006
  2. zxo102
    Replies:
    0
    Views:
    448
    zxo102
    Aug 1, 2006
  3. Mohammad Khan
    Replies:
    3
    Views:
    135
    Tom Copeland
    Jan 10, 2006
  4. saiho.yuen
    Replies:
    3
    Views:
    549
    kaeli
    Sep 14, 2004
  5. John Bailo

    IE7 shows location even if location=no

    John Bailo, Jan 19, 2007, in forum: Javascript
    Replies:
    4
    Views:
    217
    OmegaJunior
    Mar 11, 2007
Loading...

Share This Page