0

Hi all, I was having a look at this tutorial on asp.net master pages http://www.asp.net/web-forms/overview/older-versions-getting-started/master-pages/creating-a-site-wide-layout-using-master-pages-cs but alas I have to apply this the other way around: as you would normally expect, you'd create the master page first and then content pages, but I have content pages and now I have to create a master page and link it to the content pages. Is this doable or do I have to create a master page first and then content pages? Unfortunately when I begun to work to my asp.net current project I didn't even know that master pages existed!

2
Contributors
2
Replies
24
Views
3 Years
Discussion Span
Last Post by Violet_82
1

Yes, it's doable. In your content pages you can just state that you are uing a master page:

<%@ Page Language="C#" 
    MasterPageFile="~/Site.Master"  
    CodeBehind="Content.aspx.cs" 
    Inherits="Content" %>

My master page contains:

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

My content page has this:

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <!-- Your content goes here and will be rendered where the ContentPlaceHolder is -->
</asp:Content>

Edited by pritaeas

Votes + Comments
I thought you were only a php guy. i'm impressed!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.