Hi All

I'm new to dot Net but I have developed a master page template. Within this, I want to add contentplaceholders. Within those contentplaceholders, I'd like to add commented out HTML or example HTML so that my interns can see directions (such as what class to add, what to put there, etc.). When I try to create a new page, however, and reference the master page, it ignores the content I've placed within the contentplaceholder from the master page. Is there any way to fix this? I can't be the only one with this problem (though I can't find it anywhere on the web). Any help at all would be appreciated!

Thank you,

Georgia

Recommended Answers

All 4 Replies

Hello, gppuddinpie I think you are facing the problem of adding your new web page in the master page....So, please post the xhtml code of both the master page and the new web page so that it would become easier to solve your problem as quickly as possible.

Sounds good. As you can see below, I have commented out HTML that I'd like to appear in pages that I link to the master page. Here's the code for the master page:

<%@ Master Language="VB" CodeFile="Default.master.vb" Inherits="_Default" %>

<!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>
        <asp:ContentPlaceHolder ID="title" runat=server>
        </asp:ContentPlaceHolder>
    </title>
    <link rel="stylesheet" href="css/style.css" type="text/css" />
	<asp:ContentPlaceHolder id="head" runat="server">
    
    <!--Insert link to custom stylesheet here-->
    
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server" style="min-height: 100%; position: relative;">
    <div id="header">
        <div id="headerLogo">
            <a href="http://www.weber.edu">
                <img alt="Weber State University" src="http://departments.weber.edu/ce/images/WSULogo_sm.png" /></a> <a href="http://www.weber.edu">Weber
                    State University</a>
            </div>
            
        <div class="wrapper clearfix">

            <asp:ContentPlaceHolder ID="logo" runat="server">
            <!--Insert Logo Here with custom style sheet (ex: <a class="onlineLogo" href="default.aspx"></a>-->
            </asp:ContentPlaceHolder>

             <div id="block-menu">
                <h2>Primary links</h2>

            <asp:ContentPlaceHolder ID="topMenu" runat="server">
            <!--Insert .Net Menu Control Here with the CSSClass "menu" and horizontal orientation -->
            </asp:ContentPlaceHolder>                    

            </div>
        </div>
    </div>
    <!--End Header -->


    <div id="content" class="clearfix">
        <div class="wrapper clearfix" style="padding: 5px 0 10px;">
			<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            </asp:ContentPlaceHolder>
        <div style="clear: both;"></div>
        </div>
    </div>

    <div id="belowContent" class="clearfix">
        <div class="wrapper clear">
			<asp:ContentPlaceHolder ID="belowContentInfo" runat="server">
            <!--You can add divs like "socialMedia clear" and "contactInfo". Change the width in a custom stylehseet to customize-->
            </asp:ContentPlaceHolder>
       
        </div>

And here is the code that appears when I try to create a page that I link to the master page:

<%@ Page Title="" Language="VB" MasterPageFile="~/Default.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Options_Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="title" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="logo" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="topMenu" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="belowContentInfo" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="bottomFooter" Runat="Server">
</asp:Content>

Hello,

There's a little code you've forgotten to add in the Default.master....
After belowContentInfo, you've not added bottomFooter...So after </div> just try to add the following code...

<div id="bottom" class="clearfix">
        <div class="wrapper clearfix">
            <asp:ContentPlaceHolder ID="bottomFooter" runat="server">
            <!--THIS WAS MISSING-->
            </asp:ContentPlaceHolder>
        </div>
    </div>

And one more thing is that under the belowContent in the Default.master the class should be "wrapper clearfix" instead of "wrapper clear" as it does not exist...

I must have forgotten to paste that, but it is added. Regardless, adding the footer contentplaceholder would not fix my problem. I think the reality is that default content only appears after rendered and if you don't include the ContentPlaceholder in the child file, not in the design view of the child file. That's what I was looking for. I wanted ease of use for my interns. Oh well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.