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

Incorrect Paging with Filtering

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 2
Rodney asked on 08 Aug 2016, 02:06 PM

I'm getting very odd paging when I apply filters to certain grids, while others seem to be working correctly with basically the same code. What happens if I have my row result set to 25 and have 2 pages of results then I filter which only returns 5 results, the pager still shows two pages and the count still says page 1 of 2 and rows 1-25 of 26. I've attached some screen shots so you can see exactly what I'm referring to. What's worse is if you click on the pager to go to the next page it's blank and the pager control disappears. 

Here's the basic header stuff for the Grid, if you need more let me know:

<telerik:RadGrid ID="rgActionItems"
    OnItemCommand="rgActionItems_ItemCommand"
    OnItemDataBound="rgActionItems_ItemDataBound"
    ClientSettings-ClientEvents-OnGridCreated="radGrid_CreatedMaxHeight"
    ClientSettings-Scrolling-AllowScroll="true"
    runat="server"
    AllowPaging="True"
    AllowSorting="True"
    AutoGenerateColumns="False"
    CellSpacing="0"
    ClientSettings-AllowColumnsReorder="false" ClientSettings-Resizing-AllowColumnResize="false" ClientSettings-Scrolling-UseStaticHeaders="true"
    EnableLinqExpressions="False"
    ExportSettings-ExportOnlyData="true" ExportSettings-IgnorePaging="true" ExportSettings-OpenInNewWindow="true" ExportSettings-HideStructureColumns="true"
    GridLines="None"
    GroupingSettings-CaseSensitive="false" MasterTableView-AllowMultiColumnSorting="false" MasterTableView-AllowNaturalSort="false" AllowFilteringByColumn="true" MasterTableView-CommandItemDisplay="Top"
    MasterTableView-CommandItemSettings-ShowAddNewRecordButton="false"
    MasterTableView-CommandItemSettings-ShowRefreshButton="false"
    MasterTableView-CommandItemSettings-ShowExportToCsvButton="false"
    MasterTableView-CommandItemSettings-ShowExportToExcelButton="true" ExportSettings-Excel-Format="Xlsx"
    MasterTableView-CommandItemSettings-ShowExportToPdfButton="true" ExportSettings-Pdf-AllowCopy="true" ExportSettings-Pdf-AllowPrinting="true" ExportSettings-Pdf-AllowModify="true"
    MasterTableView-CommandItemSettings-ShowExportToWordButton="true" ExportSettings-Word-Format="Docx"
    PageSize="25"
    PagerStyle-PageSizes="25,50,100"
    PagerStyle-AlwaysVisible="true" PagerStyle-EnableAllOptionInPagerComboBox="true"
    MasterTableView-PagerStyle-PagerTextFormat="{4} Page {0} of {1}, rows {2} to {3} of {5}"
    MasterTableView-PagerStyle-Position="TopAndBottom"
    MasterTableView-PagerStyle-PageButtonCount="10"
    MasterTableView-PagerStyle-EnableAllOptionInPagerComboBox="false"
    MasterTableView-TableLayout="Fixed"
    >
    <MasterTableView>
        <SortExpressions>
            <telerik:GridSortExpression FieldName="" SortOrder="Ascending" />
        </SortExpressions>
        <NoRecordsTemplate>
            <asp:Label ID="Label1" Text="No Records Found" runat="server" />
        </NoRecordsTemplate>
        <Columns>

 

Thanks

Rodney

 

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Aug 2016, 06:18 AM
Hi Rodney,

Please make sure that you are not using the DataBind() method 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 (DataSourceID property)
Programmatic Data Binding (NeedDataSource event, + DetailTableDataBind for hierarchy). You should set the DataSource property ONLY within these event handler.

Regards,
Eyup
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Rodney
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Share this question
or