Determine currently sorted column in a datagrid

  • Thread starter Thread starter Henrik Bruun
  • Start date Start date
H

Henrik Bruun

How do I determine (programmatically) what the currently sorted column is in
a datagrid?

Thanks in advance

Henrik
 
There may be easier ways, but this will work. From the DataTable that is the
DataSource of the grid, get the "DefaultView" property, and from the view,
look at the "Sort" property. Note that if it is sorted descending, then the
text " DESC" will follow the column name.
 
Worked great... thanks

Henrik

Chris Botha said:
There may be easier ways, but this will work. From the DataTable that is the
DataSource of the grid, get the "DefaultView" property, and from the view,
look at the "Sort" property. Note that if it is sorted descending, then the
text " DESC" will follow the column name.


is
 
Back
Top