vb.net - .NET Gridview Paging shows different content on following pages -


i have gridview in page paging enabled (sorting not enabled, not used). onrowdatabound , onpageindexchanged events assigned.

<asp:gridview showheader="false" id="gv1" runat="server" autogeneratecolumns="false" onrowdatabound="gridview_rowdatabound" datasourceid="sqldatasource1" gridlines="none" cellpadding="0" pagesize="25" allowpaging="true" onpageindexchanging="gv1_pageindexchanging"> 

datasource assigned below gridview as:

<asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:my_connectionstring %>"></asp:sqldatasource> 

onrowdatabound used display content in formatted way. don't think causes problem:

 protected sub gridview_rowdatabound(byval sender object, byval e gridviewroweventargs)..... 

pageindexchanging defined follows:

    protected sub gv1_pageindexchanging(byval sender object, byval e system.web.ui.webcontrols.gridviewpageeventargs)     gv1.pageindex = e.newpageindex     gv1.databind() end sub 

in page_load part here's how populate datasource. it's custom query constructed in string tempsqlstr:

sqldatasource1.selectcommand = tempsqlstr if not page.ispostback      gv1.databind() end if 

everything seems working, results paged 25 records, can move through pages. recognized content of pages changing move between them. amount of records not change can see record saw on first page again in second, when move first page , again second page content of second page changes , see different set of records.

i have printed tempsqlstr value pages, same on pages (it not in "not page.ispostback" part).

can because construct tempsqlstr in page_load section , gv1_pageindex_changing cannot see value? if case why following pages showing record?

any comment appreciated. thank you.

the problem not ordering results returned , why. execute select statement 5 times , see if results same , know if this. if add order in query. let me know if solved problem otherwise can further...


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -