Results 1 to 5 of 5

Thread: [RESOLVED] Duplicate names in masterpage error

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    541

    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

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    :

    try removing the "#" sign in the commented code .

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    541

    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

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I had same problem before and it was weird for me too . I think the compiler take the hash "#" as preprocessor directive.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] Duplicate names in masterpage error

    That's entirely unexpected, good find.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width