[英]Master Page won't display its content on a Web Forms
我正在創建一個具有母版頁的Web窗體項目。 但是,當我在母版頁(或任何其他控件或html元素)上放置標簽時,它不會在Web表單上顯示它。 我該如何解決這個問題?
母版頁:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="RWA.MasterPage" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form" runat="server">
<div>
<asp:ContentPlaceHolder ID="MasterPagePlaceHolder" runat="server">
<asp:Label ID="NameLabel" runat="server" Text="Label"></asp:Label>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
網絡表格:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master"
AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="RWA.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MasterPagePlaceHolder"
runat="server">
</asp:Content>
修復了此問題,只需要從內容占位符中刪除控件即可
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.