Newbie - Can you point me in the right direction.

J

james

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
 
B

Brock Allen

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);
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top