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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top