DataGrid Sorting problem

  • Thread starter Thread starter BVM
  • Start date Start date
B

BVM

Hi:

I have a datagrid. When clicking header it sorts automatically, but when I use datagrid.DataSource to manipulate data, the row of data that user select is different from the the row (same row number) in the dataset. How can I solve this problem and find out the correct row number?

BTW, how to stop sorting? I set AllowSorting=false, but it still sortable.

Thanks,

Dennis
 
Hi,

Do not rely on the row numbers, use the CurrencyManager to get the current
row. This will give you access to the underlying row.

As for the AllowSorting, if you have added a TableStyle you must set the
AllowSorting property of the TableStyle as this overrides the DataGrid
AllowSorting property.

Hope this helps

Chris Taylor


Hi:

I have a datagrid. When clicking header it sorts automatically, but when I
use datagrid.DataSource to manipulate data, the row of data that user select
is different from the the row (same row number) in the dataset. How can I
solve this problem and find out the correct row number?

BTW, how to stop sorting? I set AllowSorting=false, but it still sortable.

Thanks,

Dennis
 
Back
Top