我已经动态添加单选按钮到webform,如下所示。 在提交时单击,当我尝试使用control.find(radiobuttonid)查找无线电检查属性时。即使选中单选按钮,它也始终返回false。有些人能帮助我怎么做吗?
RadioButton r1 = new RadioButton();
r1.ID = "r1" + i.ToString();
r1.GroupName = "radio";
PlaceHolder1.Controls.Add(r1);
Label t1 = new Label();
t1.ID = "t1" + i.ToString();
t1.Text = ReturnCode["ans1"].ToString();
PlaceHolder1.Controls.Add(t1);
PlaceHolder1.Controls.Add(
new LiteralControl("\r\n<br /> \r\n"));
RadioButton r2 = new RadioButton();
r2.GroupName = "radio";
r2.ID = "r2" + i.ToString();
PlaceHolder1.Controls.Add(r2);
Label t2 = new Label();
t2.ID = "t2" + i.ToString();
t2.Text = ReturnCode["ans2"].ToString();
PlaceHolder1.Controls.Add(t2);
PlaceHolder1.Controls.Add(
new LiteralControl("\r\n<br /> \r\n"));
RadioButton r3 = new RadioButton();
r3.ID = "r3" + i.ToString();
r3.GroupName = "radio";
PlaceHolder1.Controls.Add(r3);
Label t3 = new Label();
t3.ID = "t3" + i.ToString();
t3.Text = ReturnCode["ans3"].ToString();
PlaceHolder1.Controls.Add(t3);
PlaceHolder1.Controls.Add(
new LiteralControl("\r\n<br /> \r\n"));
RadioButton r4 = new RadioButton();
r4.ID = "r4" + i.ToString();
r4.GroupName = "radio";
PlaceHolder1.Controls.Add(r4);
Label t4 = new Label();
t4.ID = "t4" + i.ToString();
t4.Text = ReturnCode["ans3"].ToString();
PlaceHolder1.Controls.Add(t4);
PlaceHolder1.Controls.Add(
new LiteralControl("\r\n<br /> \r\n"));