Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Programmatically sort by a column

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Programmatically sort by a column
Link Posted: 13-Jun-2006 09:20
My flygrid sorts by a TreeViewColumn just the way that I want it to when I click the TreeViewColumn header.  I want to do the same sort programmatically in the code.  I tried :

flyGrid.Rows.Sort(new Column[] { componentNameCol });

where componentNameCol is the TreeViewColumn.  But it didn't work, so how can I sort in the code the same way a mouse click on the column header would?

Thanks,
Priscilla
Link Posted: 13-Jun-2006 13:20
This method used internally,
use following code to sort on column/columns:
[c#]
componentNameCol.SortOrder = SortOrder.Ascending;


Sort on multiple columns:
[c#]
flyGrid.BeginInit()
try
{
  flyGrid.Columns.Items[0].SortOrder = SortOrder.Ascending;
  flyGrid.Columns.Items[1].SortOrder = SortOrder.Descending;
}
finally
{
  flyGrid.EndInit();
}