如何获取所有RedioButton并弹出当前被选中是RedioButton的值

来源:百度文库 编辑:神马文学网 时间:2024/04/30 12:08:10
问:
如何获取所有RedioButton并弹出当前被选中是RedioButton的值
答:
foreach (var c in Page.Form.Controls)
{
     if (c is RadioButton)
     {
         RadioButton btn = c as RadioButton;
         if (btn.Checked)
         {
              Response.Write(btn.Text);
         }
      }
 }