Copied to clipboard

Flag this post as spam?

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


  • Daniel 15 posts 107 karma points
    Jul 31, 2013 @ 00:01
    Daniel
    0

    Using page directive rather than master for child templates

    I currently have a working master template that is working fine using this directive:
    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

    I have Umbraco setup so I can edit files in VS2010 as well. Umbraco is new to me and asp is relatively new as well, however I am trying to create a child template as a Page not Master, that is added to a placeholder on the master template.

    eg:

    Master Template:


    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>


    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">

    <div>Some Content</div>
    <asp:ContentPlaceHolder ID="pageContentHolder" runat="server" /> <--- Child template attach here

    </asp:Content>


    Child Template:

    <%@ Page Language="C#" MasterPageFile="~/masterpages/master.master" Inherits="OboutInc.oboutAJAXPage" %>


    <asp:content ContentPlaceHolderId="pageContentHolder" runat="server">

    <div>This content would take place in the master template</div>

    </asp:content>

    Now I'm not even sure if I should be doing it this way or not, but having everything as a master page feels wrong as well and attaching a usercontrol doesnt make much sense to me either. As I said, I am new and this may be something so stupidly simple, but I can't wrap my head around it. Obviously when you straight up change the Child template to read that way you will get :

    The directive 'page' is unknown.

    I know that's due to the fact that the file extension is .master instead of .aspx. So I tried to simply change the extension in VS, but the reference to the .master page doesnt change in Umbraco and essentially a new child.master file is created in its place as a completely blank page with no master template added. In my mind I feel there should be a way to change the path that umbraco is looking for the child template and attach it to the child.aspx file, but I could be wrong.

    So I guess in short, is it possible to use the page directive rather than have every template as a .master and if so, how?

    Im sorry if this is a really stupid question, but I have been looking online for hours and cant get a decisive answer. To make matters worse, I could swear I had the page directive setup yesterday with no problem and I ended up deleting things and changing structure, but for the life of me I dont know how. Please help! Any advise / clarity would be greatly appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft