Edit this page

Groups Collection

When a group is created it is added to the Groups collection of the corresponding template. You can access the groups collection in the following way:

Accessing groups

DataGroupCollection templateGroupCollection = this.radGridView1.MasterTemplate.Groups;

Dim templateGroupCollection = Me.RadGridView1.MasterTemplate.Groups

You can expand and collapse groups programmatically. The code blocks below demonstrates how you can expand and collapse the first group in the Groups collection.

Expanding groups



Collapse groups



You canĀ use AllowGroup property of each column to indicate whether the user will be able to group by this column or not. The default value is true.

Allow groups

this.radGridView1.Columns["Country"].AllowGroup = false;

Me.RadGridView1.Columns("Country").AllowGroup = False

DataGroup class

DataGroup collections have hierarchical structure. One or more group levels could be created. Properties of the DataGroup give access to its Level, Parent and Child groups:

Accessing parent/child groups

int groupLevel= this.radGridView1.Groups[0].Level;
Group<GridViewRowInfo> parentGroup = this.radGridView1.Groups[0].Parent;
DataGroupCollection groups = this.radGridView1.Groups[0].Groups;

Dim groupLevel As Integer = Me.RadGridView1.Groups(0).Level
Dim parentGroup As Group(Of GridViewRowInfo) = Me.RadGridView1.Groups(0).Parent
Dim groups As DataGroupCollection = Me.RadGridView1.Groups(0).Groups

The header row of a group (GridViewGroupRowInfo) can be accessed using the GroupRow property for a particular data group, for example:

Accessing group header row

GridViewRowInfo groupHeaderRow = radGridView1.Groups[0].GroupRow;

Dim groupHeaderRow = Me.RadGridView1.Groups(0).GroupRow

See Also