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

Change page size for all detailgrids in hierarchical grid

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kayday
Top achievements
Rank 1
kayday asked on 20 Aug 2015, 01:08 AM
I have a 2-level hierarchical grid. MasterTableView doesnt have paging.  The detail grids do.  If I change page size in one detail grid, I want that new page size to be applied to the rest of the detail grids.  HierarchyLoadMode is "ServerBind" with DetailTableDataBind method.  I tried to call MyGrid.Rebind() in PageSizeChanged event but DetailTableDataBind is only fired once for the grid that I switch the page size manually.  How do I apply the new page size to all detail grids?

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 24 Aug 2015, 08:43 AM
Hello,

For achieving the desired behavior you could use the following code within your OnPageSizeChanged event handler, which will traverse each expanded item and will rebind the detail table, so it could apply the new page size:
protected void RadGrid1_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
{
    e.Canceled = true;
    RadGrid1.PageSize = e.NewPageSize;
    foreach (GridDataItem item in RadGrid1.Items)
    {
        if (item.HasChildItems)
        {
            (item.ChildItem as GridNestedViewItem).NestedTableViews[0].Rebind();
        }
    }
}

Hope this helps.


Regards,
Konstantin Dikov
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
kayday
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or