简体   繁体   中英

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

要添加一行:

Set the CausesValidation="false" for the submit button.

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

You could also place the RegExValidator and the Add button into a separate ValidationGroup.

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

use the CausesValidation Property. Set to False

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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