471,881 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,881 software developers and data experts.

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
Aug 14 '07 #1
2 1618
kestrel
1,071 Expert 1GB
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
Aug 14 '07 #2
phvfl
173 Expert 100+
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:ContentPlaceHolder tag is used as a place holder for the content in the master page. The id of the ContentPlaceHolder 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:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="contentpage.aspx.vb" Inherits="contentpage" title="Master page demo" %>
  2.  
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:ContentPlaceHolder 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 ContentPlaceHolder 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
Aug 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Sasha | last post: by
5 posts views Thread by Michael Herman \(Parallelspace\) | last post: by
17 posts views Thread by Rob R. Ainscough | last post: by
7 posts views Thread by xkeops | last post: by
6 posts views Thread by =?Utf-8?B?SmF5IFBvbmR5?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.