简体   繁体   English

避免在单击特定按钮时进行验证

[英]Avoid validation on click of specific button

This question is regarding validation. 这个问题与验证有关。 I have regex validation on some fields as show in the snapshot. 我在快照中显示的某些字段上进行了正则表达式验证。 I want to run this validation only when user clicks on Add button; 我只想在用户单击“添加”按钮时运行此验证; NOT when the submit button is clicked. 单击提交按钮时不可以。 Could someone suggest how this be done? 有人可以建议如何做到吗?

For some reasons, image is not visible. 由于某些原因,图像不可见。 It's uploaded at following location: 它已上传到以下位置:

http://i.stack.imgur.com/YXnUd.png http://i.stack.imgur.com/YXnUd.png

要添加一行:

Set the CausesValidation="false" for the submit button. 为“提交”按钮设置CausesValidation="false"

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation.aspx http://msdn.microsoft.com/zh-CN/library/system.web.ui.webcontrols.button.causesvalidation.aspx

You could also place the RegExValidator and the Add button into a separate ValidationGroup. 您也可以将RegExValidator和“添加”按钮放入单独的ValidationGroup中。

http://msdn.microsoft.com/en-us/library/ms227424(v=vs.100).aspx http://msdn.microsoft.com/zh-CN/library/ms227424(v=vs.100).aspx

use the CausesValidation Property. 使用CausesValidation属性。 Set to False 设为False

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM