ASP.NET 中的母版页实现
我正在使用 vb-2008 来创建我的应用程序。我在 asp 中创建了母版页,但无法在其他页面上使用它。我使用:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" MasterPageFile="~/Mail.Master" Inherits="webform1._Default" %>
我创建母版页为:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Mail.master.cs" Inherits="master1.Mail" %>
<!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>Untitled Page</title>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
<asp:Image ID="imghead" runat="server" ImageUrl="~/images/images1.jpeg" />
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
但这并没有在实现它的其他页面上显示母版页。 我怎样才能实现母版页..
i am using vb-2008 to create my application. i created master page in asp but i am not able to use it on other pages. i used :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" MasterPageFile="~/Mail.Master" Inherits="webform1._Default" %>
i created master page as:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Mail.master.cs" Inherits="master1.Mail" %>
<!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>Untitled Page</title>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
<asp:Image ID="imghead" runat="server" ImageUrl="~/images/images1.jpeg" />
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
but this is not showing master page on other page where it is implemented..
how can i implement the master page..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在,您需要创建分配了
masterpage
的 ASPX 页面,并填充您的新页面调用的内容占位符,例如
default.aspx
将包含:A
MasterPage
仅保存其他页面将注入内容的PlaceHolders
。MasterPages 上有一个漏洞视频,您可以在这里看到:
Now you need to create ASPX pages that have the
masterpage
assigned and fill up the content placeholdersyour new page called, for example,
default.aspx
will contain:A
MasterPage
only holds thePlaceHolders
for where other pages will inject content.There is a hole Video on MasterPages that you can see here: