DataGrid Sorting Explained

R

Randy

Hello,
Could someone please explain to me how the sort works on a Windows Form
DataGrid? What I'm trying to find out information on is the fact that when
you have a DataTable bound to a datagrid through the DataSource
property...if you click on a column header and sort the datagrid, the
underlying datatable doesn't get sorted. Does the grid keep an internal
representation of the table? What would be the best way to handle
this...keep the datatable sorted in the same fashion as the datagrid?
Thanks for any help...

Cheers :)
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

Hi Randy,
Hello,
Could someone please explain to me how the sort works on a Windows Form
DataGrid? What I'm trying to find out information on is the fact that when
you have a DataTable bound to a datagrid through the DataSource
property...if you click on a column header and sort the datagrid, the
underlying datatable doesn't get sorted. Does the grid keep an internal
representation of the table? What would be the best way to handle
this...keep the datatable sorted in the same fashion as the datagrid?
Thanks for any help...

Cheers :)

Use DataView object as a bridge between DataTable & DataGrid.
All sorting changes would be keep in DataView to access.
The same way you can do any filter on your data.

Cheers!

Marcin
 

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

Top