2017-02-28 78 views
-2

我有一个asp.net web应用程序项目,其中包括总共三页,即登录页面,首页和网页视图的页面。当我运行应用程序时,它正常工作,但是当我点击任何链接或任何按钮时,它将指向第一页。我创建了甚至新的页面也gird查看但仍然问题依然存在。我不知道问题出现在网格视图或数据库中。请在这方面协助我,因为我在这个项目上做了很多工作。点击任何链接或按钮重定向到另一个页面asp.net

下面是它再次被重定向第一页的代码,并再次

<asp:Content ID="FormContentHolder" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> 
    <div class="container"> 

     <div class="row"> 
      <div id="logobar"> 
       <h1> 
        <img src="http://localhost:50090/uploads/icons/logo.png" style="height: 99px" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Document Expiry Alert System</h1> 
      </div> 
     </div> 
     <div class="row"> 
      <div> 
       <hr /> 
      </div> 
      <div id="container-fluid"> 
       <div class="col-md-3"> 
        <div id="icons"> 
         <div> 
          <a href="DatabaseGView.aspx"> 
           <img class="img-responsive" src="uploads/icons/update.png" /></a> 
          <a href="DatabaseGView.aspx">Update</a> 
         </div> 
        </div> 
       </div> 
       <div class="col-md-9"> 
        <div class="form-group"> 
         <div class="text-left"> 
          <h1>Students Database</h1> 
         </div> 
         <table class=""> 
          <tr> 
           <td class="" style="width: 30%">Registration No.</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="ID" runat="server" Width="190px" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="" style="width: 30%">First Name</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="FN" runat="server" Width="190px" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Last Name</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="LN" runat="server" Width="190px" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Nationality</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:DropDownList ID="Country1" runat="server" CssClass="form-control box-margin-8" Width="190px"> 
/--Here was very long list of countries so i removed--/ 
            </asp:DropDownList> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Email</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="email" runat="server" CssClass="form-control box-margin-8" TextMode="Email" Width="190px"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Passport No</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="passportNo" runat="server" Width="190px" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Place of Issue</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:DropDownList ID="PlaceOfIssue" runat="server" CssClass="form-control box-margin-8" Width="190px"> 
             <asp:ListItem Value="AF">Afghanistan</asp:ListItem> 
/--Here was very long list of countries so i removed--/ 
            </asp:DropDownList> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Issue</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="issue" runat="server" TextMode="Date" Width="190px" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Expiry</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="Expiry" runat="server" Width="190px" TextMode="Date" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Visa No</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="VisaNo" CssClass="form-control box-margin-8" runat="server" Width="190px"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Visa Expiry</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="VisaExpiry" runat="server" Width="190px" TextMode="Date" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">Emirates ID No</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="EmiratesNo" CssClass="form-control box-margin-8" runat="server" Width="190px"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">ID Expiry</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:TextBox ID="EmiaratesExpiry" runat="server" Width="190px" TextMode="Date" CssClass="form-control box-margin-8"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td class="">&nbsp;</td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;">&nbsp;</td> 
          </tr> 
          <tr> 
           <td class="">&nbsp; </td> 
           <td class="" style="text-align: inherit; font-family: 'Arial Black'; overflow: auto; width: 190px;"> 
            <asp:Button ID="submitt" runat="server" class="btn" OnClick="submitt_Click" Text="Submit" /> 
            <input id="Reset1" type="button" value="reset" class="btn" onclick="myFunction()" /> 
            <asp:Label ID="Label1" runat="server" /> 
            <asp:Label ID="Label2" runat="server" /> 
           </td> 
          </tr> 
         </table> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</asp:Content> 

这里是第二页: -

<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="DatabaseGView.aspx.cs" Inherits="Document_Expiry_Reminder.DatabaseGView" %> 

<asp:Content ID="FormContentHolder" ContentPlaceHolderID="ContentPlaceHolder1" runat="server" > 
    <link href="css/bootstrap.css" rel="stylesheet" /> 
    <div class="container"> 
     <div class="img-responsive" style="background-color: none;"> 
      <h1> 
       <img src="http://localhost:50090/uploads/icons/logo.png" style="height: 99px" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Student Database Administration</h1> 
        </div> 
       <div class="row"> 
      <div> 
       <hr /> 
      </div> 
     </div> 
     <div class="displayflex"> 
      <div class="row"> 
       <div class="col-md-1"> 
        <a href="FrontPage.aspx"> 
         <img class="img-responsive" src="uploads/icons/add.png" /></a> 
        <a href="FrontPage.aspx">Add</a> 
       </div> 
      </div> 
     </div> 
    </div> 
    <div class="row" style="margin-left: 5px"> 
     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
     <asp:Button ID="Button1" runat="server" Text="Search" OnClick="Button1_Click" />&nbsp;<asp:DropDownList ID="DropDownList1" runat="server"> 
      <asp:ListItem>Select Document</asp:ListItem> 
      <asp:ListItem>Passport Expiry</asp:ListItem> 
      <asp:ListItem>Visa &amp; Emirates Expiry</asp:ListItem> 
     </asp:DropDownList> 
     &nbsp;From Date 
      <asp:TextBox ID="fromDate" runat="server" TextMode="Date"></asp:TextBox> 
     &nbsp; To Date&nbsp; 
      <asp:TextBox ID="toDate" runat="server" TextMode="Date"></asp:TextBox> 
     &nbsp; 
      <asp:Button ID="Search" runat="server" OnClick="Search_Click" Text="Search" /> 
     <br /> 
     <br /> 
     <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSource1" OnRowEditing="GridView1_RowEditing" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px"> 
      <Columns> 
       <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" /> 
       <asp:BoundField DataField="ID" HeaderText="Reg No" ReadOnly="True" SortExpression="ID" /> 
       <asp:BoundField DataField="FN" HeaderText="First" SortExpression="FN" /> 
       <asp:BoundField DataField="LN" HeaderText="Last" SortExpression="LN" /> 
       <asp:BoundField DataField="Country1" HeaderText="Country" SortExpression="Country1" /> 
       <asp:BoundField DataField="gender" HeaderText="Gender" SortExpression="gender" /> 
       <asp:BoundField DataField="email" HeaderText="Email" SortExpression="email" /> 
       <asp:BoundField DataField="PassportNo" HeaderText="Passport" SortExpression="PassportNo" /> 
       <asp:BoundField DataField="PlaceOfIssue" HeaderText="Place Of Issue" SortExpression="PlaceOfIssue" /> 
       <asp:BoundField DataField="Issue" HeaderText="Issue" SortExpression="Issue" DataFormatString="{0:MM/dd/yyyy}" /> 
       <asp:BoundField DataField="Expiry" HeaderText="Expiry" SortExpression="Expiry" DataFormatString="{0:MM/dd/yyyy}" /> 
       <asp:BoundField DataField="VisaNo" HeaderText="Visa" SortExpression="VisaNo" /> 
       <asp:BoundField DataField="VisaExpiry" HeaderText="Visa Expiry" SortExpression="VisaExpiry" DataFormatString="{0:MM/dd/yyyy}" /> 
       <asp:BoundField DataField="EmiratesNo" HeaderText="Emirates ID" SortExpression="EmiratesNo" /> 
       <asp:BoundField DataField="EmiratesExpiry" HeaderText="ID Expiry" SortExpression="EmiratesExpiry" DataFormatString="{0:MM/dd/yyyy}" /> 
      </Columns> 
      <EditRowStyle BackColor="Black" ForeColor="#0033CC" /> 
      <FooterStyle BackColor="#99CCCC" ForeColor="#003399" /> 
      <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" BorderStyle="Groove" /> 
      <PagerStyle CssClass="pagination-ys" BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" /> 
      <RowStyle BackColor="White" ForeColor="#003399" HorizontalAlign="Center" /> 
      <SelectedRowStyle BackColor="#99CCFF" Font-Bold="True" ForeColor="#CCFF99" /> 
      <SortedAscendingCellStyle BackColor="#EDF6F6" /> 
      <SortedAscendingHeaderStyle BackColor="#0D4AC4" /> 
      <SortedDescendingCellStyle BackColor="#D6DFDF" /> 
      <SortedDescendingHeaderStyle BackColor="#002876" /> 
     </asp:GridView> 
     <br /> 
     <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SzabistStudentsConnectionString3 %>" DeleteCommand="DELETE FROM [Students] WHERE [ID] = @original_ID" InsertCommand="INSERT INTO [Students] ([ID], [FN], [LN], [Country1], [gender], [email], [PassportNo], [PlaceOfIssue], [Issue], [Expiry], [VisaNo], [VisaExpiry], [EmiratesNo], [EmiratesExpiry]) VALUES (@ID, @FN, @LN, @Country1, @gender, @email, @PassportNo, @PlaceOfIssue, @Issue, @Expiry, @VisaNo, @VisaExpiry, @EmiratesNo, @EmiratesExpiry)" SelectCommand="SELECT * FROM [Students]" UpdateCommand="UPDATE [Students] SET [FN] = @FN, [LN] = @LN, [Country1] = @Country1, [gender] = @gender, [email] = @email, [PassportNo] = @PassportNo, [PlaceOfIssue] = @PlaceOfIssue, [Issue] = @Issue, [Expiry] = @Expiry, [VisaNo] = @VisaNo, [VisaExpiry] = @VisaExpiry, [EmiratesNo] = @EmiratesNo, [EmiratesExpiry] = @EmiratesExpiry WHERE [ID] = @original_ID" OldValuesParameterFormatString="original_{0}"> 
      <DeleteParameters> 
       <asp:Parameter Name="original_ID" Type="String" /> 
      </DeleteParameters> 
      <InsertParameters> 
       <asp:Parameter Name="ID" Type="String" /> 
       <asp:Parameter Name="FN" Type="String" /> 
       <asp:Parameter Name="LN" Type="String" /> 
       <asp:Parameter Name="Country1" Type="String" /> 
       <asp:Parameter Name="gender" Type="String" /> 
       <asp:Parameter Name="email" Type="String" /> 
       <asp:Parameter Name="PassportNo" Type="String" /> 
       <asp:Parameter Name="PlaceOfIssue" Type="String" /> 
       <asp:Parameter DbType="Date" Name="Issue" /> 
       <asp:Parameter DbType="Date" Name="Expiry" /> 
       <asp:Parameter Name="VisaNo" Type="String" /> 
       <asp:Parameter DbType="Date" Name="VisaExpiry" /> 
       <asp:Parameter Name="EmiratesNo" Type="String" /> 
       <asp:Parameter DbType="Date" Name="EmiratesExpiry" /> 
      </InsertParameters> 
      <UpdateParameters> 
       <asp:Parameter Name="FN" Type="String" /> 
       <asp:Parameter Name="LN" Type="String" /> 
       <asp:Parameter Name="Country1" Type="String" /> 
       <asp:Parameter Name="gender" Type="String" /> 
       <asp:Parameter Name="email" Type="String" /> 
       <asp:Parameter Name="PassportNo" Type="String" /> 
       <asp:Parameter Name="PlaceOfIssue" Type="String" /> 
       <asp:Parameter DbType="Date" Name="Issue" /> 
       <asp:Parameter DbType="Date" Name="Expiry" /> 
       <asp:Parameter Name="VisaNo" Type="String" /> 
       <asp:Parameter DbType="Date" Name="VisaExpiry" /> 
       <asp:Parameter Name="EmiratesNo" Type="String" /> 
       <asp:Parameter DbType="Date" Name="EmiratesExpiry" /> 
       <asp:Parameter Name="original_ID" Type="String" /> 
      </UpdateParameters> 
     </asp:SqlDataSource> 
    </div> 
</asp:Content> 

从第二页中,任意点击在链接或按钮它重定向到fronpage.aspx这是我的项目中的firts页面

+0

我们如何在没有看到代码的情况下为您提供帮助? – ADyson

+0

先生,我已经上传了代码,请协助 –

+0

这些链接:'Add'将明确指向首页。这是可以预料的。我还可以在第二页看到两个名为“搜索”的按钮,点击时每个按钮都会调用不同的代码隐藏方法。这些方法是什么?会导致重定向的东西?您还应该检查您的Page_Load方法以及您的主页面中处理的所有事件,以查看它们是否包含重定向代码。如果您不确定发生了什么,请在您的代码中设置断点以查找重定向发生的时刻。如果你还不确定,请在这里发布代码 – ADyson

回答

0

检查母版页中的表单标签,也许它有一个ction设置为frontpage.aspx

+0

是的,它的工作表示感谢 –

相关问题