I have a gridview with the "Edit Update Cancel" field. When I click "Edit", all the columns in a particular row become editable, and when I click "Refresh", the table is updated based on the new values. Gridview then binds to the updated datatable. But the "Cancel update" button still remains.

After the line has been updated, the "Undo Update" button should be changed to "Edit." How it became possible.
Thanks at Advance
This is the code for updating and displaying updated data.
protected void StaticNoticeGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
string id = StaticNoticeGridView.Rows[e.RowIndex].Cells[0].Text;
string updatedItem = e.NewValues[0].ToString();
string updatedURL = e.NewValues[1].ToString();
StaticNoticeController staticNoticeController = new StaticNoticeController();
int rocordsAffected = staticNoticeController.UpdateStaticNoticeData(updatedItem, updatedURL, id);
if (rocordsAffected == 1)
{
this.StaticNoticeGridView.DataSource = null;
this.StaticNoticeGridView.DataSource = staticNoticeController.GetStaticNoticeData();
this.StaticNoticeGridView.DataBind();
}
}
catch(SystemException ex)
{
}
}
source
share