Wrox Programmer Forums
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 6th, 2007, 06:01 PM
Authorized User
Join Date: Feb 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with MasterPages

Hello I have been trying for the past few hours to use master pages, it seems straightforward, but I keep getting compilation errors.
Here is the code on my Content page

<% @ Page Language="C#" MasterPageFile="MasterPage.master" Title="Content Page 1" %>
<!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 = "The Title"></title></head>
<asp:Content id="Content1" contentplaceholder="ContentPlaceHolder1" runat="Server">
    Main content.

<asp:content id="Content2" contentplaceholder="ContentPlaceHolder2" runat="Server" >
    Footer content.

My first error says:
Error 1 Element 'Content' is not a known element. This can occur if there is a compilation error in the Web site. C:\Documents and Settings\bbgban\My Documents\Visual Studio 2005\WebSites\WeeklyReports\Default.aspx 7 6 C:\...\WeeklyReports

Old March 7th, 2007, 09:50 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

hi there...

replace the page directive with this and try again:

<% @ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Content Page 1" %>
the path to the maste page have something missing.. if the master page is inside a folder add it to the directive.



================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
Old March 7th, 2007, 11:48 AM
Authorized User
Join Date: Feb 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts

ahh thanks a lot that did the trick!

Similar Threads
Thread Thread Starter Forum Replies Last Post
masterpages, contentplaceholder, formview, button miltonsnider ASP.NET 2.0 Basics 5 December 4th, 2007 01:17 PM
Question about masterpages Kjella BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 3 November 29th, 2007 11:42 AM
error in source while using masterpages dotnetuser ASP.NET 2.0 Basics 4 June 28th, 2007 08:10 AM
MasterPages ContentPages and Meta tags michaelcode ASP.NET 2.0 Basics 5 June 1st, 2006 04:13 PM
MasterPages Help! polonskyg ASP.NET 2.0 Basics 1 March 24th, 2006 12:05 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.