asp.net - Datapager reverts back to original data -
i made search page linked database, when page loads use vb codebehind set sqlselectcommand
listview
returns 0 results, when client searches item change sql select like '%search%'
.
this works fine happens when click on page 2 reverts original sql statement
i using label
heading dynamically change according search key make sure data returned page
you can preview site here http://www.barkingdog.co.za/asp/search1.aspx
the same problem on office page, here though start page data in sql select when click on eg. economy , try go page 2 shows page 2 of original content
thank in advance
the vb
protected sub searchbox_textchanged(byval sender object, byval e system.eventargs) handles searchbox.textchanged dim nval string nval = searchbox.text breadcrumb.text = "results " + nval allproductsoff.selectcommand = "select * [cxpproducts] [range] '%" & nval & "%'" end sub protected sub searchbutton_click(byval sender object, byval e system.eventargs) handles searchbutton.click dim nval string nval = searchbox.text breadcrumb.text = "results " + nval allproductsoff.selectcommand = "select * [cxpproducts] [range] '%" & nval & "%'" end sub
the asp
<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" />
list view
<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>
i guessing problem in listview paging. please check query using when rebinding listview on pagepropertieschanging event follow.
protected void listview1_pagepropertieschanging(object sender, pagepropertieschangingeventargs e) { //set current page startindex, max rows , rebind false lvdatapager1.setpageproperties(e.startrowindex, e.maximumrows, false); //rebind list view bindlistview(); }
please find more details paging in listview @ following link.
Comments
Post a Comment