如何在ASP.NET中使用RequiredFieldValidator对于单选按钮 [英] How to Use RequiredFieldValidator For Radio Button in ASP.NET
本文介绍了如何在ASP.NET中使用RequiredFieldValidator对于单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI
是否可以使用ASP.NET RequiredField Validator验证ASP.NET中的单选按钮?
如果可能请给我一个小例子。
谢谢和问候
Mounika.D
HI
Is it possible to validate Radio Button in ASP.NET using ASP.NET RequiredField Validator??
If possible please give me small example.
Thanks & Regards
Mounika.D
推荐答案
您不能对单选按钮使用必需的字段验证器,但可以将其与隐藏控件一起使用。只需让您的单选按钮在单击时填充隐藏的控件。这样,如果永远不会填充隐藏控件,验证器将失败。
You can''t use the required field validator against a radio button but you can use it with a hidden control. Just have your radio button populate the hidden control when it is clicked. That way the validator will fail if the hidden control is never populated.
这篇关于如何在ASP.NET中使用RequiredFieldValidator对于单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文