use link button or button in the gridview row.
Here i am giving an example of using link button.
<asp:GridView ID="grdDoc" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="DOCCODE" Height="40px"
PageSize="8" ShowFooter="True" Visible="false"
onpageindexchanging="grdDoc_PageIndexChanging"
onselectedindexchanged="grdDoc_SelectedIndexChanged" > <PagerSettings Mode="NumericFirstLast" />
<RowStyle BackColor="WhiteSmoke" BorderColor="CornflowerBlue" ForeColor="Black"Height="30px" /> <Columns><asp:TemplateField HeaderText="Dose">
<ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CommandName="select"Text='<%#Eval("DOCCODE")%>'></asp:LinkButton> </ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DOCNAME" HeaderText="Description" />
</Columns>
<FooterStyle BackColor="Silver" Height="25px" />
<PagerStyle BackColor="DarkGray" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
</asp:GridView>
In gridview SelectedIndexChanged event
write ur code
protected void grdDoc_SelectedIndexChanged(object sender, EventArgs e)
{
txtDocCode.Text = Convert.ToString(grdDoc.SelectedDataKey.Value);
txtDocName.Text = Convert.ToString(grdDoc.SelectedRow.Cells[1].Text);
grdDoc.Visible = false;
}