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

作者:互联网

2010-07-14

ASP.NET教程

问:
如何获取所有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);
         }
      }
 }

-