You must Sign In to post a response.

Difference between rowupdated and rowupdating of gridview in asp.net

Which event shopuld be used and when?
Same occurs for deleted, deleting.


Comments

#420407    Author: Ramesh S  03 Sep 2009 Member Level: Gold   Points : 2

The RowUpdated event is raised when a row's Update button is clicked, but after the GridView control updates the row.

The RowUpdating event is raised when a row's Update button is clicked, but before the GridView control updates the row.


Thanks & Regards
Ramesh. S
 

#420410    Author: Amit Gupta  03 Sep 2009 Member Level: Gold   Points : 2

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{

int pos = e.RowIndex;

string name = ((TextBox)GridView1.Rows[pos].Cells[2].Controls[0]).Text;

ds.Tables[0].Rows[pos][1] = name;
GridView1.EditIndex = -1;
GridView1.DataBind();
}
I have written the above in rowupdating. It always takes place.
But in rowupdated, i write anything but this event is never raised.

#420441    Author: gomathinayagam    04 Sep 2009 Member Level: Gold   Points : 2

if you want to fire rowupdated event, you must fire rowupdating event first.

if you not mention row updating event then row updated event never fired.


Gomathi Nayagam

Please Rate my answer if it has helpful to you

#420444    Author: Amit Gupta  04 Sep 2009 Member Level: Gold   Points : 2

RowUpdating is working but RowUpdated does not fire.
gridview is manually bind with datasource. I have come to know that if manually bind, then RowUpdated will never fire.
Plz confirm.


This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.