We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Question on datagrid sorting for windows forms.

I have a datagrid that is bound to a datatable. The datatable.defaultview can be sorted and filtered. The user has selected row #1 which has a column of caseid = "Case123". The user changes the sort of the grid from caseid to the column of closeddate. Row #1 is now caseid = "Case987" and caseid "Case123" is now row #10. The selected row is still row #1. I want to keep the selected row on "case123" (now row #10) after the sort change. I tried datatable.defaultview.find("Case123"), but this requires changing the sort back to the caseid. Any ideas on how to reset the selected row (currentrowindex) the original selected caseid of "Case123"?

Loader.
Live Chat Icon For mobile
Up arrow icon