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

Count Groups?

3 Answers 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 29 Jul 2012, 04:06 PM
Hi,

is it possible to count the Groups in a GridView and also get the Group Header?

Thanks
Best Regards
Rene

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 30 Jul 2012, 07:40 AM
Hi Rene,

 You can use the GroupCount property of the RadGridView to count the groups. As to the group header, may I ask you to share some more details on why do you need to access it?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 30 Jul 2012, 07:52 AM
Hi,

ok, i have a RadGridView which contains 1 up to 10 Groups. In Codebehind i have to check each Group in the GridView.
For each Group i have to to somethink different, so i have to no which Groups are in the GridView.
Fas GridView contains a collection of different modules

Grid.jpg: The Grid with all possible Groups

I need somethink like
foreach(RadGridViewGroup Ggroup in RadGridView.Groups)
{
    // do somethink
}

Thanks
Best Regards
Rene
0
Dimitrina
Telerik team
answered on 31 Jul 2012, 02:19 PM
Hi,

You could get the visible GroupRows using the ChildrenOfType method. An example with the first GridViewGroupRow would be: 

GridViewGroupRow groupRow = this.clubsGrid.ChildrenOfType<GridViewGroupRow>().FirstOrDefault();
if (groupRow != null)
{
   GroupViewModel groupViewModel = groupRow.GroupViewModel as GroupViewModel;
   object header = groupViewModel.Header;
}

 Generally I would better advise you to predefine the GroupHeaderTemplate of the GridView/GridViewColumns although I am not sure if this will meet your needs. Please check the Totals WPF Demo for an example on how to predefine it. 

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
ITA
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
ITA
Top achievements
Rank 1
Share this question
or