Change page size for all detailgrids in hierarchical grid

2 posts, 1 answers
  1. kayday
    kayday avatar
    1 posts
    Member since:
    May 2015

    Posted 19 Aug 2015 Link to this post

    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?
  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 24 Aug 2015 Link to this post


    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.

    Konstantin Dikov
    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