Try This
ASPX Page:
ASPX Page:
<pre lang="text"><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestGridView.aspx.cs" Inherits="LibraryManagement.TestGridView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView runat="server" ID="gv">
<Columns>
<asp:TemplateField>
<ItemTemplate >
<asp:RadioButton runat="server" AutoPostBack="true"
oncheckedchanged="RadioButton1_CheckedChanged" GroupName="A" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
</pre>
Code Behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace LibraryManagement
{
public partial class TestGridView : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridBind();
}
}
private void GridBind()
{
DataTable dt = new DataTable();
dt.Columns.Add("Column1");
dt.Rows.Add("row1");
dt.Rows.Add("row2");
gv.DataSource = dt;
gv.DataBind();
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
RadioButton rb = (RadioButton)sender;
if (rb.Checked == true)
{
GridViewRow gvRow = (GridViewRow)rb.Parent.Parent;
TableCell td=new TableCell();
TextBox t1 = new TextBox();
TextBox t2 = new TextBox();
TextBox t3 = new TextBox();
td.Controls.Add(t1);
td.Controls.Add(t2);
td.Controls.Add(t3);
gvRow.Cells.Add(td);
}
}
}
}