There is a dynamically created radiolist button and the aim is to fire an even when the radio button is clicked. This is in a panel pnldynamic
pnldynamic.Controls.Add(lbl);
RadioButtonList rd = new RadioButtonList();
foreach (CustomerFile cu in allCustomerFile)
{
rd.Items.Add(cu.ApplicationNumber.ToString());
}
rd.AutoPostBack = true;
rd.SelectedIndexChanged += new EventHandler(radioButton_CheckedChanged);
pnldynamic.Controls.Add(rd);
Following is the eventhandler for radiobuttonlist on selectedindex change
private void radioButton_CheckedChanged(object sender, EventArgs e)
{
RadioButton btn = sender as RadioButton;
txtReferenceNumber.Text = btn.Text;
}
The breakpoint in the function is not getting hit when the radiobuttonlist is selected
Try this:
RadioButtonList rd = new RadioButtonList();
foreach (CustomerFile cu in allCustomerFile
{
rd.Items.Add(cu.ApplicationNumber.ToString());
}
rd.AutoPostBack = true;
rd.SelectedIndexChanged += new EventHandler(radioButton_CheckedChanged);
pnldynamic.Controls.Add(rd);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.