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

Access Columns of child grid in a nested Hierarchy

8 Answers 226 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rejish Rajan
Top achievements
Rank 1
Rejish Rajan asked on 12 Jul 2010, 11:30 AM
Hi,

I have RadGridView which is populated dynamically from an xml file.
I have added table definitions to the gridview through code behind  and when the grid is loaded it shows child grid to each row.
Now i want to modify the column header of the child gridview; how can i achieve this ?
I tried to get the child control (RadGridView) from IsExpandedchangeEvent of GridViewRow using ChildrenoFType<> method but it is not returning  anything.

It will be helpful if you provide me a sample project .

Thanks & Regards
Rejish.

8 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 12 Jul 2010, 11:37 AM
Hello Rejish Rajan,

 When you use Child Table Hierarchy, the child grids are of type GridViewDataControl, not RadGridView.

Kind regards,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Rejish Rajan
Top achievements
Rank 1
answered on 12 Jul 2010, 12:54 PM
Thank you for the reply.
I tried with GridViewDataControl also  in the ChildrenOfType<> method in the  IsExpandedchangeEvent , it didnt returned  the child grid control.

Thanks & Regards
Rejish.
0
Yavor Georgiev
Telerik team
answered on 12 Jul 2010, 01:00 PM
Hi Rejish Rajan,

 The IsExpandedChanged event fires before the child grid is visible and so the ChildrenOfType<> method won't be able to find the child grid. If you wish to modify the child grid's appearance, I suggest you use the HierarchyChildTemplate property. Here's a demo that shows how this can be accomplished.

All the best,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Rejish Rajan
Top achievements
Rank 1
answered on 12 Jul 2010, 04:46 PM
Hi,

Is there any method so that we can retrieve the child grid other than using childhierarchytemplate ?
My scenario is , i am populating the grid with dynamic data using the Light Weight Data table method,the child grid nesting is also dynamic and I am populating the child grid also using Light Weight Data table method.

Is there a way to add child hierarchy dynamically in the above mentioned scenario  ?

Thanks & Regards
Rejish.
0
Yavor Georgiev
Telerik team
answered on 12 Jul 2010, 04:53 PM
Hello Rejish Rajan,

 Try handling the DataLoading event of the parent grid. It is a routed event and so it will fire for all child grids as well. You can do something like this:

private void radGridView1_DataLoading(object sender, GridViewDataLoadingEventArgs e)
{
    var grid = sender as RadGridView;
    if (grid.ParentRow != null) // this means this is a child grid
    {
        // do stuff with child grid
    }
}

Best wishes,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Rejish Rajan
Top achievements
Rank 1
answered on 12 Jul 2010, 05:02 PM

It worked ,Thanks a lot.

Thanks & Regards
Rejish.
0
Rejish Rajan
Top achievements
Rank 1
answered on 16 Jul 2010, 04:13 PM
Hi,

I  have an issue with the displaying of columns and column headers  in a child grid when we  scroll horizontally the parent  grid,
the issue is that ,the column and column headers of child grid  got disordered when we scroll horizontally the parent grid view.

Please suggest me a solution to fix it ?
I have attached a screen shot of the issue.

Thanks & Regards
Rejish.
0
Yavor Georgiev
Telerik team
answered on 17 Jul 2010, 04:04 AM
Hello Rejish Rajan,

Could you please open a support ticket and attach the project which exhibits this behavior?

Best wishes,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Rejish Rajan
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Rejish Rajan
Top achievements
Rank 1
Share this question
or