Newbie - Can you point me in the right direction.

Discussion in 'ASP .Net' started by james, Mar 31, 2005.

  1. james

    james Guest

    I am trying to put together a simple site where the user can select the page
    layout from a set of templates.

    The templates will be in the form of 3 blocks of code: header, navigation
    and footer

    I have tried using user controls and calling them by using

    <%@ Register TagPrefix="uc1" TagName="Header" Src="header.ascx" %>

    however i cant figure out a wat to reference the control dynamicaly i.e

    <%@ Register TagPrefix="uc1" TagName="Header" Src= myString %>

    Is there any way of dynamicaly referencing the user control file name

    Is this the best way of trying to acheive this?

    Thanks in advance

    J
    james, Mar 31, 2005
    #1
    1. Advertising

  2. james

    Brock Allen Guest

    Control c = Page.LoadControl("~/YourControl.ascx");

    to load and create the control. then you need to add it under some other
    control in your form -- like a <asp:placeHolder>

    myPlaceHolder.Controls.Add(c);

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I am trying to put together a simple site where the user can select
    > the page layout from a set of templates.
    >
    > The templates will be in the form of 3 blocks of code: header,
    > navigation and footer
    >
    > I have tried using user controls and calling them by using
    >
    > <%@ Register TagPrefix="uc1" TagName="Header" Src="header.ascx" %>
    >
    > however i cant figure out a wat to reference the control dynamicaly
    > i.e
    >
    > <%@ Register TagPrefix="uc1" TagName="Header" Src= myString %>
    >
    > Is there any way of dynamicaly referencing the user control file name
    >
    > Is this the best way of trying to acheive this?
    >
    > Thanks in advance
    >
    > J
    >
    Brock Allen, Mar 31, 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. Marc Bishop
    Replies:
    1
    Views:
    266
    Cowboy \(Gregory A. Beamer\)
    Oct 31, 2003
  2. MooMaster
    Replies:
    3
    Views:
    314
    Simon Brunning
    Jul 4, 2005
  3. Jay Pondy
    Replies:
    5
    Views:
    307
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Mar 22, 2007
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,272
    Saraswati lakki
    Jan 6, 2012
  5. Samantha
    Replies:
    7
    Views:
    125
    Samantha
    Mar 7, 2007
Loading...

Share This Page