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

Rebinding a grandchild grid

3 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CityArchitect
Top achievements
Rank 1
CityArchitect asked on 29 Feb 2016, 10:18 AM

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,

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 02 Mar 2016, 01:35 PM
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
0
CityArchitect
Top achievements
Rank 1
answered on 02 Mar 2016, 01:54 PM

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

 

 

 

0
Viktor Tachev
Telerik team
answered on 07 Mar 2016, 09:59 AM
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
Tags
Grid
Asked by
CityArchitect
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
CityArchitect
Top achievements
Rank 1
Share this question
or