首页 新闻 会员 周边

单选按钮的选择

0
[已关闭问题]

这里有三个单选按钮RadioButton  一个按钮Button。

我想通过点击button来显示我所选的单选按钮的值

我刚学.net,啥也不会,也没有学过语言!

子无的主页 子无 | 初学一级 | 园豆:200
提问于:2009-05-06 11:19
< >
分享
其他回答(1)
0

双击 button 在点击事件里面写上:如果是弹出对话框:this.Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "alert(‘“+RadioButton.SelectText+”')",true); 这个是在页面注册了一段脚本,名字叫“js”,脚本内容是“alert(‘参数’)”这个是弹出对话框的js脚本。

邢少 | 园豆:10926 (专家六级) | 2009-05-06 14:59
0

在button的双击事件里,用foreach对每个RadioButton循环

foreach(Control   ctrl   in   this.Controls)  
            {  
                if(ctrl   is   RadioButton)  
                {  
                    RadioButton   rt=ctrl   as   RadioButton;
                    if (rt.Checked)
                        MessageBox.Show(rt.Name);  
                }  
            } 

ywchina | 园豆:435 (菜鸟二级) | 2009-05-06 15:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册