master pages and content pages in .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rathiagu
    New Member
    • Aug 2007
    • 14

    master pages and content pages in .net

    i have already a default.aspx page with headers,css everything.now i created a new master page.i need my default page as contect page to this master containing stylesheets.i need to know about the merging of these 2 and the style sheets must be applied properly for each.thanks in advance
  • kestrel
    Recognized Expert Top Contributor
    • Jul 2006
    • 1071

    #2
    Originally posted by rathiagu
    i have already a default.aspx page with headers,css everything.now i created a new master page.i need my default page as contect page to this master containing stylesheets.i need to know about the merging of these 2 and the style sheets must be applied properly for each.thanks in advance
    Hey rathiagu, im going to move this question to the HTML/CSS forum. Have a nice Day!

    --
    Kestrel

    Comment

    • phvfl
      Recognized Expert New Member
      • Aug 2007
      • 173

      #3
      Hi,

      Create the master page with all of the content that will be common across the pages that use that master page (e.g. header, footer, navigation etc.). The asp:ContentPlac eHolder tag is used as a place holder for the content in the master page. The id of the ContentPlaceHol der is used as a reference in the content file.

      The content for each page is then created in its own file. Add a MasterPageFile attribute to the page directive which specifies the master file:

      Code:
      <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="contentpage.aspx.vb" Inherits="contentpage" title="Master page demo" %>
      This can also be done automatically in VS2005 by ticking the "Select Master Page" option when creating a new web form (the master page must already exist to do this). The content is then placed in an asp:Content tag with the same id as the asp:ContentPlac eHolder that it links to. As the content code is inserted directly into the master page there is no need for any new html, head, body tags as these are already in the master page.

      As the ContentPlaceHol der is a server control it must be within the asp form. This means that the code in the head of the final document will be the same in all of the pages that use this page. The links to the CSS stylesheets will be in the head of the document so all of the documents that use the same master page will import the same CSS stylesheets.

      Hope this helps

      Comment

      Working...