如何绕过验证在ASP.NET按钮? [英] How to bypass validation for a button in ASP.NET?

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

问题描述

我有一个ASP.NET的形式,需要从用户输入。有一个在表单上提交按钮和一个名为计算器按钮,做了计算,以填充文本字段。我遇到的问题是,在表单上我有一组<的; ASP:的RequiredFieldValidator> 验证,当计算器按钮被按下的形式得到确认。我不想当按下计算器按钮,仅提交按钮进行验证所需的字段。解决这个办法?

I have an ASP.NET form that takes input from a user. There's a Submit button on the form and a button called Calc which does a calculation to populate a text field. The problem I'm having is that on the form I have a set of <ASP:REQUIREDFIELDVALIDATOR> validators and when the Calc button is pressed the form gets validated. I don't want the required fields to be validated when the Calc button is pressed, only the Submit button. Any way around this?

推荐答案

的CausesValidation 属性设置为false。

Set the CausesValidation property to false.

这篇关于如何绕过验证在ASP.NET按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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