无法运行母版页的内容页面

时间:2017-08-10 09:08:49

标签: c# asp.net

每当我尝试调试母版页的内容页面时,都会运行另一个不是内容页面的webform。我甚至试图在调试后更改URL但它不起作用。 URL会自动更改。

请指导我,可能是什么问题?

  代码下面的

是自动运行的正常webform

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="Library.Home" %>

 <!DOCTYPE html>

  <html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
<title></title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    .style1
    {
        width: 100px;
    }
    .auto-style1 {
        height: 30px;
    }
    .auto-style2 {
        height: 25px;
    }
</style>
  </head>
  <body>
<form id="form1" runat="server">
<div id="head">

    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/digLib.jpg" 
    Height="95px" />

</div>
<div id="main"><div id="img">
    <table class="style1">
        <tr>
            <td>
                &nbsp;</td>
            <td>
    <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/lib.jpg" 
     Height="314px" 
                    style="margin-left: 94px" Width="561px" />
            </td>
        </tr>
    </table>
    </div>
<div id="login">
    <table class="tbl">
        <tr>
            <td class="tblhead" colspan="2">
                Login Area</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                <asp:Label ID="lbl" runat="server" Font-Size="11px" 
   ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="auto-style1">
                &nbsp;UserName&nbsp; :</td>
            <td class="auto-style1">
                <asp:TextBox ID="txtName" runat="server" CssClass="txt">
    </asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
   runat="server" 
                    ControlToValidate="txtName" ErrorMessage="!!!" 
      ForeColor="Red" 
                    SetFocusOnError="True"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="lbl">
                Password :
            </td>
            <td>
                <asp:TextBox ID="txtPass" runat="server" CssClass="txt" 
     TextMode="Password"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" 
     runat="server" 
                    ControlToValidate="txtPass" ErrorMessage="!!!" 
     ForeColor="Red" 
                    SetFocusOnError="True"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="auto-style2">
                </td>
            <td class="auto-style2">
                <asp:RadioButton ID="rdolibrary" runat="server" 
  Checked="True" 
                    ForeColor="Green" GroupName="a" Text="Librarian" />
   &nbsp;<asp:RadioButton ID="rdosudent" runat="server" ForeColor="Green" 
   GroupName="a" 
                    Text="Student" />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                <asp:Button ID="btnLogin" runat="server" CssClass="btn" 
  Text="Login" 
                    Width="80px" Font-Size="10pt" OnClick="btnLogin_Click1" 
  OnClientClick="btnLogin" />
            </td>
        </tr>
    </table>
</div>

</div>
</form>
    </body>
   </html>
  代码下面的

是母版页的内容页面

 <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" 
  AutoEventWireup="true" CodeBehind="AdminPage.aspx.cs" 
   Inherits="Library.WebForm2" %>
  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  </asp:Content>
  <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" 
 runat="server">
<asp:Image runat="server" ID="img" ImageUrl="~/Images/lib.jpg" Height="100%" 
  Width="100%" />
  </asp:Content>
  

以下是母版页

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" 
 Inherits="Library.Site" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
 </head>
 <body>
<form id="form1" runat="server">
<div id="head">

    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/digLib.jpg" 
        Width="500px" Height="100px" />

</div><div id="main"><div id="menu">
    <table style="width:100%">
        <tr>
            <td class="tblhead">
                welcome
                </td>
        </tr>
        <tr>
            <td bgcolor="#FFA76C" style="text-align: center">
                <asp:Label ID="lblname" runat="server" ForeColor="#666666">
  </asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button11" runat="server" CssClass="btnmenu" 
 Text="ADD PUBLICATION" 
                    PostBackUrl="~/Publication.aspx" 
 CausesValidation="False" 
                     />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button1" runat="server" CssClass="btnmenu" 
   Text="ADD BOOK" 
                    PostBackUrl="~/Addbook.aspx" CausesValidation="False" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button2" runat="server" CssClass="btnmenu" 
    Text="BOOK Report" 
                    CausesValidation="False" PostBackUrl="~/bookreport.aspx" 
   />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button3" runat="server" CssClass="btnmenu" 
   Text="ADD Branch" 
                    PostBackUrl="~/Addbranch.aspx" CausesValidation="False" 
   />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button4" runat="server" CssClass="btnmenu" 
    Text="ADD Student" 
                    PostBackUrl="~/AddStudent.aspx" CausesValidation="False" 
   />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button5" runat="server" CssClass="btnmenu" 
                    Text="Student Report" CausesValidation="False" 
                    PostBackUrl="~/Studenteport.aspx" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button6" runat="server" CssClass="btnmenu" 
     Text="Issue Book" 
                    CausesValidation="False" PostBackUrl="~/BookIssue.aspx" 
   />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button7" runat="server" CssClass="btnmenu" 
                    Text="Issue Report" CausesValidation="False" 
                    PostBackUrl="~/Issuereport.aspx" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button8" runat="server" CssClass="btnmenu" 
    Text="Return Book" 
                    CausesValidation="False" PostBackUrl="~/BookReturn.aspx" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button9" runat="server" CssClass="btnmenu" 
    Text="Panalty" 
                    CausesValidation="False" PostBackUrl="~/Panalty.aspx" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button10" runat="server" CssClass="btnmenu" 
    Text="LogOut" 
                    CausesValidation="False" onclick="Button10_Click" />
            </td>
        </tr>
    </table>
    </div><div id="detail">  <asp:ContentPlaceHolder 
 id="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder></div></div>


</form>
  </body>
  </html>

0 个答案:

没有答案