I can sort datagridview column by automatic sortmode. But my problem is, when i set column is automatic sort that mean The "Status" column always in sort mode and if there have any data change it will move to anythere following sort mode
I don't wanna this. I just want sort on and then off but retain the row position. I mean:
step 1: when user change status of the "Status" column, it isn't sort data
step 2: then, when user click to column header, it sort data descending
step 3: after that, when user change any status of the "Status" column, it is not sort but retain rows position in datagridview (that mean row which status is changed, doesn't move to anywhere)
is there any right way to achieve this? Thanks you for you help.
Here's what I suggest in this situation:
DataTable
, do so. DataTable
with data type Integer
. DefaultView
of the DataTable
and set the values in the extra column sequentially. Sort
property of the DefaultView
. That's it. The data is now sorted by that numeric sequence in that column so you can make whatever changes you want to the rest of the data without affecting the order.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.