My code is not working on selectedindexchanged on dynamic radiobuttonlist control
public void data1()
{
Table tbldynamic = new Table();
for (int i = 0; i < 4; i++)
{
connection = new DAL_Layer();
dt = new DataTable();
dsCommonData = connection.returnDataSet("pro");
dt = dsCommonData.Tables[i];
TableCell tc1 = new TableCell();
TableRow tr1 = new TableRow();
RadioButtonList rdn = new RadioButtonList();
rdn.ID = "rdn" + i;
rdn.Text = "rdn" + i;
// DataRowView dr = e.Row.DataItem as DataRowView;
rdn.SelectedValue = dt.Rows[0]["name"].ToString();
rdn.SelectedIndexChanged+= new EventHandler(rbl_SelectedIndexChanged);
//rdn.AutoPostBack = true;
rdn.DataSource = dt;
rdn.DataTextField = "name";
// checkbox.DataValueField = "id";
rdn.DataBind();
tc1.Controls.Add(rdn);
tr1.Cells.Add(tc1);
tbldynamic.Rows.Add(tr1);
}
panel2.Controls.Add(tbldynamic);
}
protected void rbl_SelectedIndexChanged(object sender, EventArgs e)
{
for (int i = 0; i < 4; i++)
{
RadioButtonList c = (RadioButtonList)panel2.FindControl("rdn");
lblid.Text = c.SelectedItem.Text;
}
}