1) Add a row below or above your gridview with the editable fields (textboxes and other controls) with a lable (lblSelectedRecord) to show Record ID and two buttons (btnUpdate & btnCancel)
2) Add Button(which will not be displayed on the page) on your aspx page as:
<asp:button runat="server" id="btnHDN" style="display:none" onclick="btnHDN_Click" xmlns:asp="#unknown" />
3) Add a invisible label(lblRecordID) with text as record ID at 0th column of your gridview and add this code inside the "OnRowDataBound" event.
Label lbl = new Label();
lbl = (Label)e.Row.FindControl("lblRecordID");
document.getElementById("lblSelectedRecord").value = rowId;
In your code-behind write:
protected void btnHDN_Click(object sender, EventArgs e)
string _recordId = lblSelectedRecord.Text.Trim();
5) Write update functionality in btnUpdate_Click event and cancelling functionality in btnCancel_Click event
6) Re-bind your gridview.
7) Make adjustments to the code as it is not tested. It is just randomly written.