Click here to Skip to main content
16,022,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created Master page in
HousingScocity
My Solution
HousingScocity
project Name
MasterPages
Master pages Folder
in that folder
UserMaster
User Master folder
in User Master Folder Created form
UserMaster.Master


in project Root Directory I have another folder called
Pages

in which My pages is present which is linked to UserMaster.Master

but it is not showing master Pages content

What I have tried:

<pre><%@ Master Language="C#" AutoEventWireup="true" CodeBehind="UserMaster.master.cs" Inherits="HousingScocity.MasterPages.UserMaster.UserMaster" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <style>
.vl {
    border-left: 6px solid green;
    height: 500px;
    position: absolute;
    left: 50%;
    margin-left: -3px;
    top: 0;
}
</style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
            <div>
                <h1>WELCOME TO ONLIN E HOUING</h1>
            <hr />
            </div>
            <div>
                
                                                                                                                
                <asp:Button ID="homebtn" runat="server" Text="HOME" />
 <asp:Button ID="Searchbtn" runat="server" Text="SEARCH" />
 <asp:Button ID="RENTLISTbtn" runat="server" Text="RENTLIST" />
 <asp:Button ID="SELLISTBTN" runat="server" Text="SELLISTBTN" />

             
                <asp:Button ID="Contactbtn" runat="server" Text="Contact" />

            </div>
            <hr />
            <div>
                ALL RESERVE @2018
            </div>
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>



My page code is as(home.aspx) code is as

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/UserMaster/UserMaster.Master" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="HousingScocity.Pages.Home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
mxklcmvmxvm
</asp:Content>
Posted
Updated 24-Feb-18 23:05pm
v2

1 solution

Hi
here wrongly put content inside the ContentPlaceHolder in a master page.
so you have to put content as below.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="UserMaster.master.cs" Inherits="HousingScocity.MasterPages.UserMaster.UserMaster" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <style>
.vl {
    border-left: 6px solid green;
    height: 500px;
    position: absolute;
    left: 50%;
    margin-left: -3px;
    top: 0;
}
</style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
                <h1>WELCOME TO ONLIN E HOUING</h1>
            <hr />
            </div>
            <div>
                
                                                                                                                
                <asp:Button ID="homebtn" runat="server" Text="HOME" />
                <asp:Button ID="Searchbtn" runat="server" Text="SEARCH" />
                <asp:Button ID="RENTLISTbtn" runat="server" Text="RENTLIST" />
                <asp:Button ID="SELLISTBTN" runat="server" Text="SELLISTBTN" />

             
                <asp:Button ID="Contactbtn" runat="server" Text="Contact" />

            </div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
            
                </asp:ContentPlaceHolder>
            <hr />
            <div>
                ALL RESERVE @2018
            </div>
        
    </div>
    </form>
</body>
</html>

Click here for example
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900