The Uye The Uye - 25 days ago 13
Vb.net Question

How to create group alpabet gridview devexpress?

Can any one help me to create group alphabet gridview to look like this picture?
I've tried with this code, but rows are not grouped by alphabet.

Private Sub GridView1_CustomColumnDisplayText(sender As Object, e As CustomColumnDisplayTextEventArgs) Handles GridView1.CustomColumnDisplayText
If e.Column.FieldName = "CompanyName" AndAlso e.IsForGroupRow Then
Dim rowValue As String = GridView1.GetGroupRowValue(e.GroupRowHandle, e.Column)
Dim val As String = Microsoft.VisualBasic.Left(rowValue, 1)
e.DisplayText = val
End If
End Sub


group alpabet gridview devexpress

Answer

There is no need to handle the CustomColumnDisplay text event handler to extract the first letter of the "CompanyName" value. Instead, simply set the GridColumn.GroupInterval property for the "CompanyName" GridColumn to "Alphabetical". For instance:

MyGridView.Columns("CompanyName").GroupInterval = ColumnGroupInterval.Alphabetical
Comments