ASPX Page
===============
<asp:GridView ID="gvChild" 
    runat="server" AutoGenerateColumns="False" 
    DataKeyNames="product_arm_type_skey,arm_type,rate_index_type_skey,product_type_skey"
    SkinID="SearchResultsGridViews" 
    OnRowUpdating="gvChild_RowUpdating" 
    OnRowCancelingEdit="gvChild_RowCancelingEdit" 
    OnRowDataBound="gvChild_RowDataBound"
    OnRowEditing="gvChild_RowEditing" 
    OnRowCommand="gvChild_RowCommand" 
    OnRowCreated="gvChild_RowCreated"> 
<Columns>
<asp:TemplateField>
    <ItemTemplate>
        <asp:ImageButton ID="btnEdit" runat="server" ToolTip="Edit" 
        CommandName="Edit" CommandArgument="<%# Container.DataItemIndex %>" 
        ImageUrl="~/Images/EditDocument.gif" /> 
    </ItemTemplate> 
    <EditItemTemplate> 
        <asp:ImageButton ID="btnUpdate" runat="server" ToolTip="Update" 
        CommandName="Update" CommandArgument="<%# Container.DataItemIndex %>" 
        ImageUrl="~/Images/Save.gif" /> 
        <asp:ImageButton ID="btnCancel" runat="server" ToolTip="Cancel" 
        CommandName="Cancel" CommandArgument="<%# Container.DataItemIndex %>" 
        ImageUrl="~/Images/close.png" /> 
    </EditItemTemplate> 
</asp:TemplateField> 
</Columns> 
</asp:GridView>



ASPX.CS Page
================
protected void gvChild_RowDataBound(object sender, GridViewRowEventArgs e)
{
    // if enter key is pressed (keycode==13) call __doPostBack on grid and with 
    // 1st param = gvChild.UniqueID (Gridviews UniqueID)
    // 2nd param = CommandName=Update$  +  CommandArgument=RowIndex
    if ((e.Row.RowState == DataControlRowState.Edit) || 
       (e.Row.RowState == (DataControlRowState.Edit|DataControlRowState.Alternate)))
    {
        e.Row.Cells[0].Width = Unit.Pixel(35);
        e.Row.Attributes.Add("onkeypress", "javascript:if (event.keyCode == 13) { 
            __doPostBack('" + gvChild.UniqueID + "', 'Update$" + 
           e.Row.RowIndex.ToString() + "'); return false; }");
    } 
}


protected void gvChild_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "copy")
    { 
    }
    else if (e.CommandName == "remove")
    {
    } 
    else if (e.CommandName == "up")
    {
    }
    else if (e.CommandName == "down")
    {
    }
    else if (e.CommandName == "Update")
    {
         GridViewRow row = gvChild.Rows[Convert.ToInt32(e.CommandArgument)];
         ProductArmType pat = GetByProductArmTypeSkey(productArmTypeSkey);
         pat.CustomProductName = 
            ((TextBox)(row.FindControl("txtCustomName"))).Text;
         DataRepository.ProductArmTypeProvider.Update(pat);
         gvChild.EditIndex = -1;
    } 
    gvChild.EditIndex = -1;
    BindChild();  //rebind gvChild gridview after update or any other command
}

protected void gvChild_RowUpdating(object sender, GridViewUpdateEventArgs e)
{ 
    //Could handle update here, but chose to do it in gvChild_RowCommand
}