如何在ASP.NET下遍历指定页面上所有控件
//遍历form中的控件查找哪个RadioButton是否被选中
foreach (Control control in this.form.Controls)
{
if (control is RadioButton)
{
//如果Checked
if ((control as RadioButton).Checked == true)
{
//TODO
}
}
}
foreach (Control control in this.form.Controls)
{
if (control is RadioButton)
{
//如果Checked
if ((control as RadioButton).Checked == true)
{
//TODO
}
}
}