Rebinding a grandchild grid

4 posts, 0 answers
  1. CityArchitect
    CityArchitect avatar
    5 posts
    Member since:
    Jun 2006

    Posted 29 Feb Link to this post

    Hello,

    I have a RadGrid with MasterView, a child GridTableView, and then a further child GridTableView. On a Button firing in the child view I do this:

        protected void CIncludeConnection_Click(object sender, EventArgs e)
        {
            IncludeConnection_Click(sender, e);
            RebindChildren();
        }

        protected void CExcludeConnection_Click(object sender, EventArgs e)
        {
            ExcludeConnection_Click(sender, e);
            RebindChildren();
        }

     protected void RebindChildren()
        {
            GridTableView tableView = (GridTableView)ConnectionsGrid.MasterTableView.Items[0].ChildItem.NestedTableViews[0]; // accessing child gridview of first parentitem

            tableView.Rebind(); 
        }

    which works fine, the grid view updates visually and no collapsing occurs.

    The problem is with the Grandchild view where I do this:

        protected void GCIncludeConnection_Click(object sender, EventArgs e)
        {
            IncludeConnection_Click(sender, e);
            RebindGrandChildren();
        }

        protected void GCExcludeConnection_Click(object sender, EventArgs e)
        {
            ExcludeConnection_Click(sender, e);
            RebindGrandChildren();
        }

        protected void RebindGrandChildren()
        {
            GridTableView tableView = (GridTableView)ConnectionsGrid.MasterTableView.Items[0].ChildItem.NestedTableViews[0]; // accessing child gridview of first parentitem

            GridTableView nestedView = (GridTableView)tableView.Items[0].ChildItem.NestedTableViews[0]; // Accessing grandchild gridview

            nestedView.Rebind();
        }

    Which works correctly but does not update visually at all.

    Is there a generic method of addressing any grid at any depth and Rebinding without collapsing (a generic Masterview rebind collapses) from a button event given the sender object and the EventArgs?

    protected void AnyConnectionOperation_Click(object sender, EventArgs e) ?

    Thanks,

     

     

     

     

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 02 Mar Link to this post

    Hi,

    If you would like to keep the items in RadGrid expanded after postback you should set the RetainExpandStateOnRebind property of RadGrid to true.

    Give the approach a try and see how the behavior changes.

    Regards,
    Viktor Tachev
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. CityArchitect
    CityArchitect avatar
    5 posts
    Member since:
    Jun 2006

    Posted 02 Mar in reply to Viktor Tachev Link to this post

    Hello Victor,

    I put in RetainExpandStateOnRebind which sounds really useful but didnt actually change anything immediately.

    Then I called TableView.Rebind() for children AND grandchildren regardless of which tableView I was firing buttons from and it did the trick. Grids stayed expended and status updated visually.

    Thanks!

     

    Steve

     

     

     

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 07 Mar Link to this post

    Hi,

    I am glad that the suggestion was helpful to you.

    Thank you for sharing your approach with the community.

    Regards,
    Viktor Tachev
    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