Click here to Skip to main content
16,019,618 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
Hi,

When I'm trying to delete the row of my Datagridview using binding navigator Delete button, it is deleting two rows instead of one row, but when i refresh the datagridview its deleting only 1 row. How can i avoid this error.

Plz help me..
its urgent...
Posted
Updated 14-Mar-12 4:02am
v2

1 solution

You should be using the DataGridViewCellEventArgs.

C#
private void bindingNavigatorDeleteItem_Click(object sender, 
                                                  DataGridViewCellEventArgs e) 
{
   int cRow =  gridEventType.Rows[e.RowIndex];

   //delete row from persisted storage

   //rebind data to persisted storage or remove row directly:
   gridEventType.Rows.RemoveAt(cRow);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900