This is the code snippet, you can enhance and use as you require. Just handle the row-editing event in code-behind.
asp:GridView ID="gvwTest" runat="server" CssClass="display" AutoGenerateColumns="False" DataKeyNames="id" OnRowEditing="gvwTest_RowEditing" Width="100%">
<columns>
<asp:boundfield datafield="code" headertext="Code" itemstyle-width="75px" xmlns:asp="#unknown" />
<asp:boundfield datafield="name" headertext="Name" xmlns:asp="#unknown" />
<asp:commandfield showeditbutton="True" itemstyle-width="50px" xmlns:asp="#unknown" />
</columns>