I am using ADO.Net datadridview. I am updating the data in a paginated row in the datagridview. With the following code, I stay on the same page, but I cannot stay on the updated row. How can I be both on the same page and on the row I'm updated on?
this.dataGridView1.DataSource = GetCurrentRecords(this.CurrentPageIndex, conn);
Amit MohantyPosted Feb 21, 2024, 5:44 AM
Try this:
Mehmet FatihPosted Feb 21, 2024, 6:21 AM
Thanks Amit. It worked for me.
Abhishek YadavPosted Feb 21, 2024, 5:16 AM
After updating the data in a paginated row in the datagridview, you can try to set the CurrentCell property of the datagridview to the updated row to stay on the same page and on the row you updated. Here is an example of how you can achieve this:
By setting the CurrentCell property of the datagridview to the updated row, the datagridview will stay on the same page and scroll to the updated row. You can customize the above code according to the structure of your datagridview and how you handle the updated row.