huseyin Posted December 3, 2006 Share Posted December 3, 2006 hi i am a student doing my graduation project,i am designing a web application by using asp.net2005 , i have 8 pages in my project, and i need to add a Master page (which i know very little about) to my project, but i dont know how to combine master page with already done pages. can anybody help ? i will be very happy , thank you for ur replies Link to comment Share on other sites More sharing options...
jesh Posted December 4, 2006 Share Posted December 4, 2006 Here's a sample Master Page: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="DefaultPage.master.cs" Inherits="DefaultMasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"><title></title></head><body><asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server" /></body></html> And a page that would use it: <%@ Page Language="C#" MasterPageFile="DefaultPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Test Page" %><asp:Content ID="Content" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">Hello World!</asp:Content> The code that is in the <asp:Content></asp:Content> element will be placed in the ContentPlaceHolder of the master page. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 4, 2006 Share Posted December 4, 2006 What is a "master" page? What is the difference between that and a "normal" page? Link to comment Share on other sites More sharing options...
jesh Posted December 4, 2006 Share Posted December 4, 2006 What is a "master" page? What is the difference between that and a "normal" page?It's a .NET 2.0 attempt at creating templates for sites. If you set up a master page with most of your layout design, you could then build a series of pages that use that master page to display the content. Kind of like using includes in PHP.I haven't played around with them too much, but that's what I've discovered so far. Link to comment Share on other sites More sharing options...
huseyin Posted December 5, 2006 Author Share Posted December 5, 2006 deadline for projects are comming,help please if u know about masterpage Link to comment Share on other sites More sharing options...
aspnetguy Posted December 5, 2006 Share Posted December 5, 2006 You have to create the master page first. It s your template then the other pages just contain content boxes.here is a small tutorial http://aspnet.4guysfromrolla.com/articles/010505-1.aspx Link to comment Share on other sites More sharing options...
quackquack Posted December 5, 2006 Share Posted December 5, 2006 Here's a sample Master Page:<%@ Master Language="C#" AutoEventWireup="true" CodeFile="DefaultPage.master.cs" Inherits="DefaultMasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"><title></title></head><body><asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server" /></body></html> And a page that would use it: <%@ Page Language="C#" MasterPageFile="DefaultPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Test Page" %><asp:Content ID="Content" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">Hello World!</asp:Content> The code that is in the <asp:Content></asp:Content> element will be placed in the ContentPlaceHolder of the master page. Umm . . . does it always need XHTML for asp? Iv'e tried few asp's on HTML that is effortless. Link to comment Share on other sites More sharing options...
pulpfiction Posted December 5, 2006 Share Posted December 5, 2006 This might help you a little,http://www.c-sharpcorner.com/Code/2004/May/MasterPages.asp Link to comment Share on other sites More sharing options...
jesh Posted December 5, 2006 Share Posted December 5, 2006 Umm . . . does it always need XHTML for asp? Iv'e tried few asp's on HTML that is effortless.That's just the way my version of Visual Studio (2005) created the master page. Just like any website, you don't need to use XHTML. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now