To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Article :: Building Dynamic Systems with Expressions in .NET
How Is XML Like An Interface?
Understanding Covariance and Contravariance
Print VS 2010 Keyboard Shortcut References in Letter (8.5x11in) and A4 (210×297mm) Sizes
Updated Productivity Power Tools



Go Back   VBForums > .NET > ASP.NET

Reply Post New Thread
 
Thread Tools Display Modes
Old Nov 17th, 2008, 05:57 PM   #1
stricknyn
Fanatic Member
 
Join Date: Mar 04
Posts: 521
stricknyn is an unknown quantity at this point (<10)
Resolved [RESOLVED] Duplicate names in masterpage error

Hi all,

I have a masterpage which contains three content place holders. Please note that all three content place holders are named something different. See code:
Code:
<%@ Master Language="VB" CodeFile="site.master.vb" Inherits="site" %>

<!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>Phi beta Sigma Fraternity, Inc. - Delta Xi Sigma chapter</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    <link href="styles/style3.css" media="screen" rel="stylesheet" title="CSS" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
<div id="container">
    <!-- Begin Masthead -->
	<div id="masthead">
		<img alt="" height="66" src="images/logo.gif" width="150" /><p>office (000) 
		000-0000<br />
		fax (000) 000-0000<br />
		toll-free (000) 000-0000</p>
	</div>
	<!-- End Masthead -->
	
	<!-- Begin Navigation -->
	<div id="navigation">
		<ul>
			<li><a href="default.html">Home</a></li>
			<li><a href="about/about.htm">About</a></li>
			<li><a href="news/news.htm">News</a></li>
			<li><a href="products/products.htm">Products</a></li>
			<li><a href="services/services.htm">Services</a></li>
			<li><a href="calendar/calendar.htm">Calendar</a></li>
			<li><a href="contact/contact.htm">Contact</a></li>
		</ul>
	</div>
	<!-- End Navigation -->
	
	<div id="page_content">
	    <!-- Begin Left Column -->
		<div id="column_l">
			<!-- #BeginEditable "content" -->
			<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
                <h2>Headline 2</h2>
		        <p>insert content here</p>
            </asp:ContentPlaceHolder>
			<!-- #EndEditable -->
		</div>
		<!-- End Left Column -->
        
        <!-- Begin Right Column -->
		<div id="column_r">
			<!-- #BeginEditable "sidebar" -->
			<asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server">
                <h3>Headline 3</h3>
			    <p>insert content here</p>
            </asp:ContentPlaceHolder>
			<!-- #EndEditable -->
		</div>
		<!-- End Right Column -->
        
	</div>
	<!-- End Page Content -->


</div>  
    </form>
</body>
</html>
When I create a new webform named "Default.aspx" and reference this masterpage I get an error on the default.aspx page that reads "There are <asp:ContentPlaceHolder> controls with duplicate names in the MasterPage. Correct the problem in the specified MasterPage." Again, looking back at the masterpage shows that all my content place holders are named something different. If I run it the webpage pops up just fine and looks fine. But when I stop it this error is still there. Here is the default.aspx page as well:

Code:
<%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>
Can anyone see anything out of the ordinary? I'm using VS 2008 and ASP.NET 2.0.

Thanks,

Strick
stricknyn is offline   Reply With Quote
Old Nov 17th, 2008, 10:54 PM   #2
Pirate
Elite Member ®
 
Join Date: Aug 02
Location: RUH
Posts: 8,063
Pirate has a spectacular aura about (125+)Pirate has a spectacular aura about (125+)
:

try removing the "#" sign in the commented code .
__________________
Pirate is offline   Reply With Quote
Old Nov 18th, 2008, 12:46 AM   #3
stricknyn
Fanatic Member
 
Join Date: Mar 04
Posts: 521
stricknyn is an unknown quantity at this point (<10)
Re: Duplicate names in masterpage error

Wow I think that solved it. That's weird that something commented out was causing that problem.

Thanks for your help,

Strick
stricknyn is offline   Reply With Quote
Old Nov 18th, 2008, 04:20 AM   #4
Pirate
Elite Member ®
 
Join Date: Aug 02
Location: RUH
Posts: 8,063
Pirate has a spectacular aura about (125+)Pirate has a spectacular aura about (125+)
I had same problem before and it was weird for me too . I think the compiler take the hash "#" as preprocessor directive.
__________________
Pirate is offline   Reply With Quote
Old Nov 19th, 2008, 05:04 AM   #5
mendhak
ASP.NET Moderator
 
mendhak's Avatar
 
Join Date: Feb 02
Location: Ulaan Baator GooGoo: Frog
Posts: 38,150
mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)mendhak has a brilliant future (2000+)
Re: [RESOLVED] Duplicate names in masterpage error

That's entirely unexpected, good find.
mendhak is offline   Reply With Quote
Reply

Go Back   VBForums > .NET > ASP.NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:45 PM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.