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

Hierarchy child tables

2 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yaakov Davis
Top achievements
Rank 1
Yaakov Davis asked on 27 Dec 2010, 01:47 PM
It appears that child grid control references are kept in the parent row, even after the row has been collapsed.
Can I make the child grid get disposed?

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 28 Dec 2010, 07:48 AM
Hi,

 Indeed the child grid is cached currently and not created on every expand. Here is an example how use RowIsExpandedChanged event to clear this:

private void RadGridView1_RowIsExpandedChanged(object sender, RowEventArgs e)
{
    var row = e.Row as GridViewRow;
    if (row != null && !row.IsExpanded)
    {
        var presenter = e.Row.ChildrenOfType<ContentPresenter>().Where(c => c.Name == "PART_HierarchyChildPresenter").FirstOrDefault();
        if (presenter != null)
        {
            presenter.Content = null;
        }
    }
}



Greetings,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Yaakov Davis
Top achievements
Rank 1
answered on 28 Dec 2010, 08:49 AM
Thanks,
Yaakov
Tags
GridView
Asked by
Yaakov Davis
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Yaakov Davis
Top achievements
Rank 1
Share this question
or