Most likely reason is, you are always binding the data to the
GridView
without checking the
IsPostBack
property.
When you are clicking the "
Update
" button, the
Page_Load()
event gets invoked before the
RowUpdating()
event method is invoked. So, the
GridView
is getting bound again with the old value (Because you might not checked the
IsPostBack
flag) and hence, inside the
RowUpdating()
event method you are getting the old value.
If my assumption is correct, to solve this, change the Data binding method of the
GridView
as follows:
if (!IsPostBack)
{
GridView1.DataSource =
GridView1.DataBind();
}