User Control in Page Layout
Hi
I am creating a page layout for our ECM site. I want to use my .net user control in page layout.
Here is what I have done.
Created a user control, strong named it and deployed it in GAC
Added safe control entry in web.config
Registered my user control on the layout page and then wrap the control tag in the code.
I am able to create page using my page layout but I dont see my user control. I dont get any error either.
If I print some text on user control load event then I am getting that text but I dont see the page layout. I've put my control under
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES
Am I missing something or I can not use user control in page layout ?
Any help would be greatly appreciated.
Regards
[892 byte] By [
AmitV] at [2007-12-29]
I did this as described below.
1) Created user control.
2) Pasted both "ascx" and "ascx.cs" to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES
3) Write a Class Lib (dll) , sign with key, deploy to GAC.
protected override void CreateChildControls()
{
base.CreateChildControls();
this.Controls.Add(this.Page.LoadControl("~/_controltemplates/MyFolder/MyUserControl.ascx"));
}
4) iisreset
5) In SiteCollection settings, Galleries , WebParts, add web part to site coll. (I think you missed this step)
6) Use wherever you want.
Hi Abdul
Thanks for your reply.
I see what you are doing. You are loading user conrol using web part.
In my page layout I dont have web part zone.
I want to know if its possible to load user control in page layout without using web part.
Regards
Amit
Hi Amit,
Did you get it?
I'm trying the same thing: use a ascx inside a page layout without web parts.
Could you give me some advices?
Thanks, any info will be appreciated.