我的页面未显示母版页内容 [英] My page is not showing master page content

查看:63
本文介绍了我的页面未显示母版页内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了母版页面

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



其中我的页面存在且链接到UserMaster.Master



但它没有显示主页面内容



我尝试过:




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>







我的页码为(home.aspx)代码是






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>

推荐答案

Hi


这里错误地将内容放在母版页的ContentPlaceHolder中。

所以你必须把内容放在下面。



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>



点击此处


这篇关于我的页面未显示母版页内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆