I have created a template for my Umbraco content. I have
also added an ASP.Net user control on it.The template contains a server side control in it, is it possible for me
to read the server side control in my user control. I tried using the “FindControl”
method and it did not work.
Control test = Page.Master.FindControl("Control1");
Could someone
tell me how to solve this issue. Can I read a server side control from the
templates (Master page)?
The way to do this is not by including the control directly in the master page, but by making the UserControl into a macro.
Copy the Control's .ascx file to /usercontrols and the .dll file into your /bin folder.
Go to Developer > Macro's and right-click to create a new one. Then pick your ascx file there. Go back to the template and hit the "Insert macro" button at the top, select the macro, an you're done.
Reading server control from templates
I have created a template for my Umbraco content. I have also added an ASP.Net user control on it. The template contains a server side control in it, is it possible for me to read the server side control in my user control. I tried using the “FindControl” method and it did not work.
Control test = Page.Master.FindControl("Control1");
Could someone tell me how to solve this issue. Can I read a server side control from the templates (Master page)?
The way to do this is not by including the control directly in the master page, but by making the UserControl into a macro.
Copy the Control's .ascx file to /usercontrols and the .dll file into your /bin folder.
Go to Developer > Macro's and right-click to create a new one. Then pick your ascx file there. Go back to the template and hit the "Insert macro" button at the top, select the macro, an you're done.
is working on a reply...