This is a migrated thread and some comments may be shown as answers.

Additional Pager items using original index

3 Answers 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 02 Oct 2015, 11:49 AM

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

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 07 Oct 2015, 12:07 PM
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
0
Paul
Top achievements
Rank 1
answered on 08 Oct 2015, 10:31 AM
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
0
Eyup
Telerik team
answered on 13 Oct 2015, 08:08 AM
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
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Paul
Top achievements
Rank 1
Share this question
or