Hi siamandm,
I have created a sample which full fill your requirement
HTML
<div>
<asp:Panel ID="pnlDetails" Visible="false" runat="server">
<table>
<tr>
<th>
Label
</th>
<th>
Value
</th>
</tr>
<tr>
<td>
CustomerId:-
</td>
<td>
<asp:Label ID="lblCustomerId" runat="server" />
</td>
</tr>
<tr>
<td>
Name:-
</td>
<td>
<asp:TextBox ID="txtName" runat="server" />
</td>
</tr>
<tr>
<td>
Country:-
</td>
<td>
<asp:TextBox ID="txtCountry" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" Text="Update" runat="server" />
</td>
<td>
<asp:Button ID="Button2" Text="Cancel" runat="server" />
</td>
</tr>
</table>
</asp:Panel>
<br />
<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="CustomerId" HeaderText="CustomerId" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnEdit" Text="Edit" OnClick="Edit_Click" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ToString();
DataTable dt = new DataTable("Customers");
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("SELECT TOP 5 CustomerId,Name,Country from Customers", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
gvCustomers.DataSource = dt;
gvCustomers.DataBind();
}
}
protected void Edit_Click(object sender, EventArgs e)
{
GridViewRow selectedRow = ((sender as Button).NamingContainer as GridViewRow);
lblCustomerId.Text = selectedRow.Cells[0].Text;
txtName.Text = selectedRow.Cells[1].Text;
txtCountry.Text = selectedRow.Cells[2].Text;
pnlDetails.Visible = true;
}
ScreenShot