如何在内容页之后添加母版页
本文关键字:之后 添加 母版页 | 更新日期: 2023-09-27 18:20:25
这是我新添加的主页:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Feedback.master.cs" Inherits="Login.Feedback" %>
<!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="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td height="166">
<asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/App_Data/AdRotator.xml"></asp:XmlDataSource></td>
<td> <img alt="Welcome to Teachers Evaluation System" src="Images/welcome.png"
style="width: 662px; height: 166px" /></td>
</tr>
<tr>
<td valign="top">
<asp:ContentPlaceHolder ID="bodyContent" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
这是我的登录页面。我希望它源自大师。我需要做哪些更改?它给出了很多错误。此外,我不想向主文件添加任何代码-我应该保留Feedback.Master.cs
和Feedback.Master.Designer
吗
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Login._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>Home Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>Administrator</asp:ListItem>
<asp:ListItem>Student</asp:ListItem>
<asp:ListItem>Faculty</asp:ListItem>
<asp:ListItem>Head of Department</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="User Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Connect"
Width="79px" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Login"
Width="70px" />
</div>
</form>
</body>
</html>
在登录页面中,将<body>
标记更改为<asp:Content runat="server" ContentPlaceHolderID="bodyContent">
。
然后删除上面和下面的所有内容,并将MasterPageFile="~/Feedback.master
添加到@Page
指令中。