DataGrid Sorting problem

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
 
C

Chris Taylor

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
 

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