asp.net中怎么判断其中一个radiobutton被选中后登录的是一个窗体,另一个被选中后登录的是另一个窗体。

页面设置两按钮的GroupName为同一组值:

<asp:RadioButton ID="RadioButton1" runat="server" GroupName="RadioButtons" />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="RadioButtons" />

后台取值代码:

     string strValue = Request["RadioButtons"];
            if (strValue == RadioButton1.ID)
            {
                //选中按钮1
                oJavaScript.Alert("aa");
            }
            else if (strValue == RadioButton2.ID)
            {
                //选中按钮2
                oJavaScript.Alert("bb");
            }

//或者以下代码
if (RadioButton1.Checked)
{
    //选中按钮1
}
else if (RadioButton2.Checked)
{
    //选中按钮2
}

 

posted on 2013-12-20 16:55  zero_zz  阅读(664)  评论(0编辑  收藏  举报