日期:2014-05-17 浏览次数:20525 次
性别 <asp:RadioButton ID="r1_1" runat="server" GroupName="g1" Text="男" /> <asp:RadioButton ID="r1_2" runat="server" GroupName="g1" Text="女" /> <br /> 选择 <asp:CheckBox ID="c1_1" runat="server" Text="选择1" /> <br /> <asp:CheckBox ID="c1_2" runat="server" Text="选择2"/> <br />
foreach (Control cl in this.form1.Controls) { if (cl is RadioButton) { RadioButton tempR = ((RadioButton)cl); if (tempR.Checked) { //此处省略 } } if (cl is CheckBox) { CheckBox tempC = ((CheckBox)cl); if (tempC.Checked) { //此处省略 } } }