web user control in a master page?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stimp

    web user control in a master page?

    I have a few master page files on a large site.

    I want them all the share the same footer, but I don't want to re-enter
    the footer text on all of them.

    So I logically thought I could add a web user control to the master page
    which would contain the footer text.

    so I add:

    <%@ Register TagPrefix="gn" TagName="gnfoot er" Src="/gnfooter.ascx"
    %>

    <gn:gnfooter id="ctlFooter" runat="server" />


    but I keep getting an error saying "gnfooter is not a known element".

    Are user controls not allowed in master pages?

    What would the alternative be to this problem?

    Thanks.
    --

    fiddlewidawiddu m
  • Peter Bucher [MVP]

    #2
    Re: web user control in a master page?

    Hello Stim
    >I have a few master page files on a large site.
    >
    I want them all the share the same footer, but I don't want to re-enter
    the footer text on all of them.
    >
    So I logically thought I could add a web user control to the master page
    which would contain the footer text.
    Keyword: Nested masterpages
    UserControls are surely allowed on masterpages,
    check your src-attribute.

    --
    Gruss, Peter Bucher
    Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
    http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET

    Comment

    • Stimp

      #3
      Re: web user control in a master page?

      On Tue, 11 Mar 2008 Peter Bucher [MVP] <peter.bucher@a spnetzone.dewro te:
      Hello Stim
      >
      >>I have a few master page files on a large site.
      >>
      >I want them all the share the same footer, but I don't want to re-enter
      >the footer text on all of them.
      >>
      >So I logically thought I could add a web user control to the master page
      >which would contain the footer text.
      Keyword: Nested masterpages
      UserControls are surely allowed on masterpages,
      check your src-attribute.
      >
      ah yes... "~/gnfooter.ascx" was the solution!

      cheers!

      --

      fiddlewidawiddu m

      Comment

      • Peter Bucher [MVP]

        #4
        Re: web user control in a master page?

        Hello Stimp
        ah yes... "~/gnfooter.ascx" was the solution!
        Fine

        But, the other solution with nested masterpages is also a one to think about
        :-)

        --
        Gruss, Peter Bucher
        Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
        http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
        http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET

        Comment

        Working...