Datapager reverts back to original data

pchudjhp

New Member
I made a search page linked to a database, when the page loads I use VB Codebehind to set the \[code\]SqlSelectCommand\[/code\] for the \[code\]ListView\[/code\] so it returns 0 results, when a client the searches for a item I change the Sql select to \[code\]LIKE '%search%'\[/code\] .This all works fine but what happens is that when you click on page 2 it reverts back to the original sql statementI am using a \[code\]Label\[/code\] for a heading which I also dynamically change according to the search key to make sure the data is returned to the pageYou can Preview my site herehttp://www.barkingdog.co.za/asp/Search1.aspxThe same problem On the Office page, here though I start the page with data in the sql select but when I click on eg. economy and then try to go to page 2 it shows page 2 of the original contentThank you in advanceThe VB\[code\]Protected Sub SearchBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles SearchBox.TextChanged Dim nval As String nval = Searchbox.Text BreadCrumb.Text = "Results for " + nval AllProductsOff.SelectCommand = "SELECT * FROM [cxpproducts] WHERE [Range] LIKE '%" & nval & "%'"End SubProtected Sub SearchButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SearchButton.Click Dim nval As String nval = Searchbox.Text BreadCrumb.Text = "Results for " + nval AllProductsOff.SelectCommand = "SELECT * FROM [cxpproducts] WHERE [Range] LIKE '%" & nval & "%'"End Sub\[/code\]The ASP\[code\] <asp:TextBox ID="SearchBox" runat="server" AutoPostBack="True"></asp:TextBox> <asp:Button ID="SearchButton" runat="server" Text="Search" PostBackUrl="./Search1.aspx" style="margin-top: 0px" />\[/code\]List View\[code\] <LayoutTemplate> <div style="" align="center"> <asp:DataPager ID="DataPager2" runat="server"> <Fields> <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" ShowNextPageButton="True" ShowPreviousPageButton="True" NextPageText=">>" LastPageText="Last" PreviousPageText="<<" /> <asp:NumericPagerField /> <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> </Fields> </asp:DataPager> </div> <div ID="itemPlaceholderContainer" runat="server" class="style25"> <span runat="server" id="itemPlaceholder" /> </div> <div style="" align="center"> <asp:DataPager ID="DataPager1" runat="server"> <Fields> <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" NextPageText=">>" PreviousPageText="<<" /> <asp:NumericPagerField /> </Fields> </asp:DataPager> </div> </LayoutTemplate>\[/code\]
 
Back
Top