Click here to Skip to main content
15,912,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using a gridview and I'm updating the data using the edit button.

when the update is completed I'm putting the grid back to the edit mode but i need to bind the data after the update so the problem is that when i use this command in the updating event:

GridView1.EditIndex = -1

the grid is not in the updating mode anymore nor in the editing mode so what is the event that i should use to bind the data using this command:

GridView1.DataBind()

and if i put the databind before changing the index, the editIndex will not change..

any help is much appreciated !

thank you..
Posted

1 solution

If you want to fire RowEditing after updating the row, then do like below in RowUpdating Event.
C#
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    //...... Other codes...........//
    
    GridView1.EditIndex = -1;
    
    // Binding the GridView after update.
    GridView1.DataBind();
    
    // Now call the RowEditing Event.
    GridView1_RowEditing(sender, new GridViewEditEventArgs(e.RowIndex));
}
 
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