How do I perform multicolumn sorting in a GridDataBoundGrid?
In a GridDataBoundGrid, you can sort a columns by either clicking or double-clicking the column headers. By default it supports sort a single column. In this section, we provide a sample that contains a SortHelper class that you can include in any projects to facilitate multicolumn sorting. This helper class requires your datasource to be a DataTable (or DataView or DataSet+TableName).
User can sort columns by clicking the header cells just as before, and also if the user perform ctl+clicks, the sorting will retain current sort order for any column that is already sorted. In this manner, the user can do multicolumn sorts. There is also an API call in the SortHelper class that allows you to programmatically sort multiple columns from code.
C#
private GridMultiColSortHelper sortHelper = null;
private void Form1_Load(object sender, System.EventArgs e)
{
//create and wire the sorthelper object
sortHelper = new GridMultiColSortHelper();
sortHelper.WireGrid(this.gridDataBoundGrid1, true); //true indicate teh helper will resize to fit column headers
}
VB
Private sortHelper As GridMultiColSortHelper = Nothing
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'create and wire the sorthelper object
sortHelper = New GridMultiColSortHelper
sortHelper.WireGrid(Me.gridDataBoundGrid1, True) 'true indicate teh helper will resize to fit column headers
End Sub 'Form1_Load
Here is the link with both CS and VB samples: http://websamples.syncfusion.com/samples/kb/grid.windows/GDBGMultiSort/main.htm