How to place User controls in a Page template?

Y

Yoramo

I'm using a page template and I would like some of my components to be user
controls.

where do i put the declaration for the User control (there is no aspx file
only a C# file)?
something like the line bellow:
<%@ Register TagPrefix="uc1" TagName="Title" Src="Components/Title.ascx" %>

and how do i use the control in my template page?

thanks in advance
Yoramo
 
G

Guest

You can add the control at runtime..
e.g to add the control "SignIn.ascx" located in "/Directory/" to a control "DirectoryPane" in the page.. you write following in init event of the page..

DirectoryPane.Controls.Add(Page.LoadControl("~/Directory/SignIn.ascx"))

Hope this help
Avneesh
 

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

Top