Hallo,
ich soll für meine Firma eine ASP seite gestalten zum anzeigen von Datensätzen.
Soweit sogut.
Jetzt soll man aber nur wahlweise 50 ; 100 ; 200 Datensätze pro Seite haben. Hab ich auch hinbekommen.
Das eigentliche Problem ist, das wenn ich meine Einstellungen getan habe: In einer Textbox ein suchwort eingeben, in einer Checkbox einen haken rein gemacht habe, damit ich alle Datensätze sehen kann , und dann auf meinen Button klicke, zeigt er mir auch das ergebnis an.
WENN man jetzt jedoch durchs Paiging auf die zweite seite klicken will, schmeißt der alles wieder raus und gibt mir die "Startseite" aus, obwohl alles noch so ist wie es der benutzer haben möchte.
Hier mal den Code der ASP Seite:
Ich möchte das wenn man etwas sucht, und dieses Ergebniss auf zwei oder mehr seiten zu sehen ist, das wenn man auf seite 2 klickt, der nur die Suchanfrage anzeigt.
Hoffe das ich mich klar und einigermaßen verständlich ausgedrückt habe.
und ich hoffe mal , das mir jemand helfen kann.
Gruß
ich soll für meine Firma eine ASP seite gestalten zum anzeigen von Datensätzen.
Soweit sogut.
Jetzt soll man aber nur wahlweise 50 ; 100 ; 200 Datensätze pro Seite haben. Hab ich auch hinbekommen.
Das eigentliche Problem ist, das wenn ich meine Einstellungen getan habe: In einer Textbox ein suchwort eingeben, in einer Checkbox einen haken rein gemacht habe, damit ich alle Datensätze sehen kann , und dann auf meinen Button klicke, zeigt er mir auch das ergebnis an.
WENN man jetzt jedoch durchs Paiging auf die zweite seite klicken will, schmeißt der alles wieder raus und gibt mir die "Startseite" aus, obwohl alles noch so ist wie es der benutzer haben möchte.
Hier mal den Code der ASP Seite:
Visual Basic-Quellcode
- <%@ Page Language="VB" Debug="True" Strict="True" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.OleDb" %>
- <script runat="server"> Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) If DropDownList1.SelectedItem.Text = "50" Then GridView1.PageSize = 50 ElseIf DropDownList1.SelectedItem.Text = "100" Then GridView1.PageSize = 100 ElseIf DropDownList1.SelectedItem.Text = "200" Then GridView1.PageSize = 200 End If If CheckBox1.Checked = True Then SqlDataSource1.SelectCommand = "SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] WHERE [URI] LIKE '%" & TextBox1.Text & "%' ORDER BY [URI] DESC" Else SqlDataSource1.SelectCommand = "SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] WHERE [STATUS] <> 'done' ORDER BY [URI] DESC" End If Suchen() End Sub
- Public Sub Suchen() If TextBox1.Text <> "" And CheckBox1.Checked = False Then SqlDataSource1.SelectCommand = "SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] WHERE [URI] LIKE '%" & TextBox1.Text & "%' AND [STATUS] <> 'done' ORDER BY [URI] DESC" ElseIf TextBox1.Text <> "" And CheckBox1.Checked = True Then SqlDataSource1.SelectCommand = "SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] WHERE [URI] LIKE '%" & TextBox1.Text & "%' ORDER BY [URI] DESC"
- End If End Sub Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) If DropDownList1.SelectedItem.Text = "50" Then GridView1.PageSize = 50 ElseIf DropDownList1.SelectedItem.Text = "100" Then GridView1.PageSize = 100 ElseIf DropDownList1.SelectedItem.Text = "200" Then GridView1.PageSize = 200 End If If CheckBox1.Checked = True Then SqlDataSource1.SelectCommand = "SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] WHERE [URI] LIKE '%" & TextBox1.Text & "%' ORDER BY [URI] DESC" Else SqlDataSource1.SelectCommand = "SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] WHERE [STATUS] <> 'done' ORDER BY [URI] DESC" End If Suchen() End Sub </script><html><head><title>DataRepositoryQueue</title> <style type="text/css">
- .style3 { width: 151px; } .style4 { width: 105px; } .style5 { width: 179px; } .style6 { width: 74px; } </style> </head><body> <form id="form1" runat="server"> <h1> <b>DataRepositoryQueue</b></h1> <table frame="box"> <tr> <td class="style3"> <b>URI:</b></td> <td class="style4"> <b>Status:</b></td> <td> <b>Pagesize:</b></td> <td class="style6" rowspan="2"><asp:Button ID="Button3" runat="server" Text="Refresh" onclick="Button3_Click" /> </td> <td class="style5" rowspan="2"> <div style="margin-left: 25px; padding-left: 5px; display: block; border: solid 1px gray; width:150px;"> 2 - Folder<br /> 4 - Structure Group<br /> 16 - Component<br /> 64 - Page </div> </td> </tr> <tr> <td class="style3"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </td> <td class="style4"> <asp:CheckBox ID="CheckBox1" runat="server" Text="see all items" /> </td> <td> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>50</asp:ListItem> <asp:ListItem>100</asp:ListItem> <asp:ListItem>200</asp:ListItem> </asp:DropDownList> </td> </tr> </table> <br /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" AllowPaging="False" AllowSorting="True" PageSize="50" Width="100%" OnSorting="GridView1_Sorting" EmptyDataText="No Data found!" EnableSortingAndPagingCallbacks="True"> <PagerSettings Position="TopAndBottom" /> <EmptyDataRowStyle BackColor="#FF3300" Font-Size="Medium" Font-Underline="True" ForeColor="White" /> <Columns> <asp:BoundField DataField="QueueTime" HeaderText="QueueTime" SortExpression="QueueTime" /> <asp:BoundField DataField="URI" HeaderText="URI" SortExpression="URI" /> <asp:BoundField DataField="ItemType" HeaderText="ItemType" SortExpression="ItemType" /> <asp:BoundField DataField="Todo" HeaderText="Todo" SortExpression="Todo" /> <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" /> </Columns> <PagerStyle HorizontalAlign="Center" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DataRepositoryQueueConnectionString2 %>" SelectCommand="SELECT [QueueTime], [URI], [ItemType], [Todo], [Status] FROM [TRI_DataRepositoryToDo] where Status <> 'done' ORDER BY [QueueTime] DESC" EnableCaching="True"> </asp:SqlDataSource>
- </form> </body></html>
Ich möchte das wenn man etwas sucht, und dieses Ergebniss auf zwei oder mehr seiten zu sehen ist, das wenn man auf seite 2 klickt, der nur die Suchanfrage anzeigt.
Hoffe das ich mich klar und einigermaßen verständlich ausgedrückt habe.
und ich hoffe mal , das mir jemand helfen kann.
Gruß