2017-02-28 2 views
-2

ログインページ、フロントページ、グリッドビューのページの合計3ページを含むasp.net Webアプリケーションプロジェクトがあります。私はアプリケーションを実行すると正常に動作しますが、リンクやボタンをクリックすると、最初のページに移動します。私はgird Viewでも新しいページを作成しましたが、それでも問題は解決しません。グリッドビューやデータベースに問題があるかどうかわかりません。私がこのプロジェクトで多く働いたので、この点で私を助けてください。任意のリンクまたはボタンをクリックすると別のページにリダイレクトされる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> 

ここでは、2ページ目です: - 2ページ目から

<%@ 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> 

、任意のクリックをリンクまたはボタンで、プロジェクトのfirtsページであるfronpage.aspxにリダイレクトされます。

+0

コードを見ずにどうやってお手伝いしますか? – ADyson

+0

先生、コードをアップロードしました。助けてください –

+0

これらのリンク:Addは明らかに先頭ページに向かいます。それが期待される。 2番目のページには「検索」という2つのボタンがあり、クリックするとそれぞれ異なるコードビハインドメソッドが呼び出されます。これらの方法には何がありますか?リダイレクトの原因となるものは何ですか? Page_Loadメソッドとマスターページで処理されるイベントをチェックして、リダイレクトコードが含まれているかどうかを確認する必要があります。何が起こっているのかわからない場合は、コードにブレークポイントを設定して、リダイレクトが発生した瞬間を見つけてください。あなたがまだ不明な場合は、ここにコードを投稿してください – ADyson

答えて

0

マスターページのフォームタグをチェックしてください。 ctionがfrontpage.aspxに設定されました

+0

はい、感謝しました –

関連する問題