+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Problem adding nested MasterPages

Problem adding nested MasterPages

6 posts, 0 answered
  1. Andrew
    Andrew avatar
    4 posts
    Registered:
    27 Jan 2009
    13 Feb 2009
    Link to this post
    I am trying to move our existing site into sitefinity, and am pretty stuck when it comes to adding Templates based on nested MasterPages.

    1. In sitefinity Admin, go to Pages | Templates | Upload master page
    2. Choose Base.Master, which looks like this:

    <%@ Master Language="C#" AutoEventWireup="true"  %>

    <html>
    ...

    <asp:ContentPlaceHolder ID="MainContent" runat="server" />
    ...
    </html>

    3. Save.  Now Upload another master page, called Child.Master, which looks like this:

     <%@ Master Language="C#" MasterPageFile="~/App_Master/Base.Master" AutoEventWireup="true" CodeBehind="Child.master.cs" Inherits="Site.Child" %>

    <asp:Content ID="ChildMainContent" ContentPlaceHolderID="MainContent" runat="server">
    ...

    4. Add a code-behind called Child.Master.cs, which looks like this:

    namespace Site
    {
        public partial class Child : System.Web.UI.MasterPage
        {
    ...
        }

    5. Save.  Click on Child.Master.  Get this error:

    Could not load type 'Site.Child'.

    Do I need to upload a dll or something?

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Feb 2009
    Link to this post
    Hi Andrew,

    Please refer to the KB article Does Sitefinity support nested master pages?
    I believe it will help you to narrow down the problem.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Andrew
    Andrew avatar
    4 posts
    Registered:
    27 Jan 2009
    17 Feb 2009
    Link to this post
    I am still stuck.
    My Base Template seems to work fine, I can click on it, edit it, apply a theme.  But the child Masterpage is still not happy.
    I've tried removing CodeBehind and Inherits properties from the Master directive, but no luck.
    For example, change

     <%@ Master Language="C#" MasterPageFile="Base.Master" AutoEventWireup="true" CodeBehind="Base.master.cs" Inherits="Site.Base" %>

    to

    <%@ Master Language="C#" MasterPageFile="Base.Master" AutoEventWireup="true" %>

    But then, controls which have event handlers defined in the code behind are returning an error:

    Compiler Error Message: CS0117: 'ASP.app_master_base_master' does not contain a definition for 'QuickLinksSelectionChange'

    Source Error:

    Line 85: <asp:Content ID="SiteSearchArea" ContentPlaceHolderID="SearchArea" runat="server">
    Line 86: 
    Line 87: <asp:DropDownList ID="links" runat="server" AutoPostBack="True" OnTextChanged="OnLinksSelectionChange" >Line 88:         <asp:ListItem Text="Item 1" Value="~/Item1.aspx" />
    Line 89:         <asp:ListItem Text="item 2" Value="~/Item2.aspx" />

    Source File: c:\Program Files\telerik\Sitefinity3.5\WebSites\TestCMS\App_Master\Child.Master    Line: 87

    Do you have an example of a nested master page that could be uploaded as templates, so I could see it working?


  4. Andrew
    Andrew avatar
    4 posts
    Registered:
    27 Jan 2009
    17 Feb 2009
    Link to this post
    OK I figured out the issue.
    The Master directive must use CodeFile rather then CodeBehind property.

    The hint I got when I read this KB article
    http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bbgd-b1154T-cgb.aspx
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    18 Feb 2009
    Link to this post
    Hi Andrew,

    I am glad you have it working now.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Andrew
    Andrew avatar
    4 posts
    Registered:
    27 Jan 2009
Register for webinar
6 posts, 0 answered