博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

Posted on 2010-09-08 01:50  赖鱼塘  阅读(247)  评论(0)    收藏  举报

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

-