Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Raguvind 1 post 21 karma points
    Oct 12, 2009 @ 07:33
    Raguvind
    0

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

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Oct 12, 2009 @ 13:43
    Sebastiaan Janssen
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft