有一个动态创建的单选列表按钮,目的是即使单击该单选按钮也可以触发一个单选按钮。在面板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);
以下是selectedindex上单选按钮列表的事件处理程序 改变
private void radioButton_CheckedChanged(object sender, EventArgs e)
{
RadioButton btn = sender as RadioButton;
txtReferenceNumber.Text = btn.Text;
}
选择单选按钮列表时,函数中的断点没有被击中
答案 0 :(得分:0)
尝试一下:
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);