如何在asp.net中验证radiobuttonlist [英] how to validate radiobuttonlist in asp.net

查看:89
本文介绍了如何在asp.net中验证radiobuttonlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好





我想在按钮的点击事件中使用C#验证asp.net中的radiobuttonlist,如果用户havnt选择了radiobuttonlist然后会弹出消息来选择radiobuttonlist。



帮助我,请提供必要的代码来验证radiobuttonlist。





提前感谢

解决方案

看到这个...... :)



http://forums.asp.net/t/1199803.aspx [ ^ ]


< blockquote>这个人可以帮你吗





http://forums.asp.net/t/1112298.aspx/1 [ ^ ]


  if < /温泉n>(rbl_Answer.SelectedIndex!= -1)
{
string answer = rbl_Answer.SelectedItem.Text;
string option = rbl_Answer.SelectedItem.Value;
}
else
{
lblError.Text = 选择选项;
}



其中rbl_Answer是ASP.Net页面中的RadioButtonList。如果未选中,则在标签或消息框中显示错误消息


hello


I wants to validate radiobuttonlist in asp.net with C# on the click event of the button,if the user havnt selected the radiobuttonlist then it will pop up message to select the radiobuttonlist.

help me,please give the necessary code to validate radiobuttonlist .


thanks in advance

解决方案

see this...:)

http://forums.asp.net/t/1199803.aspx[^]


may this one will help you


http://forums.asp.net/t/1112298.aspx/1[^]


if (rbl_Answer.SelectedIndex != -1)
           {
               string answer = rbl_Answer.SelectedItem.Text;
               string option = rbl_Answer.SelectedItem.Value;
           }
           else
           {
               lblError.Text="Select the Option";
           }


where rbl_Answer is the RadioButtonList in your ASP.Net page. If it is not selected show the error message in label or a Message box


这篇关于如何在asp.net中验证radiobuttonlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆