Asp.net必填字段验证器 [英] Asp.net Required Field Validator
本文介绍了Asp.net必填字段验证器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在页面中添加了必填字段验证器.
工作正常....
当我单击特定按钮时,我需要该验证器才能工作,现在,当我单击页面中的任何按钮时,它就会触发.
我如何控制它?
I added required field validator in a page.
its working fine....
i need that validator to work when i click on a particular button,now its firing when i clicked on any of the button in the page.
How can i control it?
推荐答案
您需要将所有验证控件属性设置为一个验证组.请在此处 http://msdn.microsoft.com/en-us/library/ms227424中查看验证组. aspx#Y204 [ ^ ]
You need to set all validating controls property to one Validation Group. See Validation Group here http://msdn.microsoft.com/en-us/library/ms227424.aspx#Y204[^]
在页面中使用自定义验证器.并在cutomvalidation中调用onserverValidation属性上的函数...
Use custom validator in your page..and call your function on onserverValidation property in a cutomvalidation...
您可以控制此功能通过使用groupName,可以为按钮控件以及您要针对特定按钮验证的其他控件提供验证属性.
You can control this by using the groupName, cause validation Property for the button control and other control that you want to validate for particular button.
这篇关于Asp.net必填字段验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文