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!

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>
commented: I thought you were only a php guy. i'm impressed! +12

cool thanks, I will give it a go then

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.