TelerikDeveloper.com

TelerikDeveloper.com

sgray128 5/2/2015 11:01:53 AM

Winforms - Gridview - Grouping

Code examples for grouping functionality in WinForms GridView


 

 

'======================================================================================================
'set grouping
'======================================================================================================
Dim groupdescriptor As New Telerik.WinControls.Data.GroupDescriptor()
groupdescriptor.GroupNames.Add("employeeName", System.ComponentModel.ListSortDirection.Ascending)
Me.RadGridView1.GroupDescriptors.Add(groupdescriptor)
 
Dim groupdescriptor2 As New Global.Telerik.WinControls.Data.GroupDescriptor()
groupdescriptor2.GroupNames.Add("BillingDate", System.ComponentModel.ListSortDirection.Ascending)
'The text of the group header row is a formatted string with the following parameters:
'{0} – Property name –the name of the RadGridView column by which the grouping is performed;
'{1} – Group value
'{2}, {3} … - Aggregates values
groupdescriptor2.Format = "{0}: {1:MM/dd/yyyy} "
Me.RadGridView1.GroupDescriptors.Add(groupdescriptor2)
 
'set the grid datasource
Me.RadGridView1.DataSource = getGridDataSource()
'expand the groups
For Each oDataGroup As DataGroup In Me.RadGridView1.Groups
    oDataGroup.Expand()
Next
'======================================================================================================