Additional Pager items using original index

4 posts, 0 answers
  1. Paul
    Paul  avatar
    4 posts
    Member since:
    Mar 2014

    Posted 02 Oct 2015 Link to this post

    Hi,

     I've found an issue with the RadGrid, where the pager is showing the following buttons 1,2,3,4,5,6,7,8,9,10,...

     All these buttons are working correctly. When I click on '...', I then get the following list: ...,8,9,10,11,12,13,14,15,16,17

     The problem I'm having is that this second set of buttons is selecting the index from that list, so clicking '...' will go to the first page of results, '8' being the 2nd item in the list will go to page 2 etc. The control looks and behaves exactly as though one of the original options 1-10 had been selected and seems to correspond to the position/index of the selected button rather than its content.

     The relevant code snippet for the pager configuration is as follows:

    <telerik:RadGrid ID="rgSearchResults" AllowPaging="false" AllowSorting="false" 
            PageSize="25" runat="server" AllowFilteringByColumn="false" ShowGroupPanel="False" 
            EnableLinqExpressions="False">
            <PagerStyle Mode="NumericPages" Position="TopAndBottom" AlwaysVisible="True" PageButtonCount="10"  />
            <ClientSettings>
                 <ClientEvents OnMasterTableViewCreating="MasterTableViewCreating" />
                <ClientEvents OnGridCreated="OnGridCreated" />
            </ClientSettings>
            <MasterTableView AllowPaging="True" AllowSorting="True" PageSize="10" CommandItemDisplay="None" 
            DataKeyNames="ID" AutoGenerateColumns="False" ShowHeader="false">

     Please could you advise on how to fix this? I've updated to the latest version of the UI for ASP.NET AJAX code. I wonder whether I'm missing some property?

    Thanks

  2. Eyup
    Admin
    Eyup avatar
    3819 posts

    Posted 07 Oct 2015 Link to this post

    Hello Paul,

    Could you verify that you are not using DataBind() to bind the grid?. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
    Declarative DataSource
    Programmatic Data Binding


    Looking forward to your reply.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Paul
    Paul  avatar
    4 posts
    Member since:
    Mar 2014

    Posted 08 Oct 2015 Link to this post

    Hi Eyup,

    Thanks for taking a look at this.

    We're doing a DataBind on its own only if the page is not PostBack.
    All other times we use either:

    Private Sub BindResults()
                Dim dv As DataView = GetResults()
                litDebug.Text &= "Total Rows: " & dv.Count & "<br/>"
                rgSearchResults.DataSource = dv
                rgSearchResults.CurrentPageIndex = 0
                rgSearchResults.DataBind()
            End Sub

    Or if the Grid's NeedDataSource fires then we use:

    Private Sub rgSearchResults_NeedDataSource(ByVal sender As Object, ByVal e As GridNeedDataSourceEventArgs) Handles rgSearchResults.NeedDataSource
                rgSearchResults.DataSource = GetResults()
            End Sub

    Can you see anything I'm doing wrong?

    Thanks,

    Paul
  4. Eyup
    Admin
    Eyup avatar
    3819 posts

    Posted 13 Oct 2015 Link to this post

    Hi Paul,

    Remove the BindResults logic altogether and let the NeedDataSource event handler alone to handle any binding logic and let me know about the result.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top