Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET Gridview Paging shows different content on following pages
    primarykey
    data
    text
    <p>I have a GridView in a page with paging enabled (sorting not enabled, not used). OnRowDataBound and OnPageIndexChanged events are assigned.</p> <pre><code>&lt;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"&gt; </code></pre> <p>Datasource is assigned just below gridview as:</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:my_connectionstring %&gt;"&gt;&lt;/asp:SqlDataSource&gt; </code></pre> <p>OnRowDataBound is used to display content in a formatted way. I don't think it causes any problem:</p> <pre><code> Protected Sub gridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)..... </code></pre> <p>PageIndexChanging is defined as follows:</p> <pre><code> Protected Sub GV1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) GV1.PageIndex = e.NewPageIndex GV1.DataBind() End Sub </code></pre> <p>In Page_Load Part here's how I populate datasource. It's from custom query constructed in string tempSqlStr:</p> <pre><code>SqlDataSource1.SelectCommand = tempSqlStr If Not Page.IsPostBack Then GV1.DataBind() End If </code></pre> <p>Everything seems to be working, I get results paged by 25 records, I can move through pages. But what I recognized is the content of pages are changing as I move between them. The amount of records do not change but I can see a record I saw on first page again in second, when I move back to first page and then again to second page content of second page changes and I see a different set of records.</p> <p>I have printed tempSqlStr value to all pages, it is same on all pages (it is not in "not page.ispostback" part).</p> <p>Can it be because I construct tempSqlStr in Page_Load section and GV1_PageIndex_Changing cannot see the value? If this is the case why following pages showing record?</p> <p>Any comment is appreciated. Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload