ASP.NET中带有按钮的正则表达式验证器 [英] Regular expression validator with button in asp.net

查看:73
本文介绍了ASP.NET中带有按钮的正则表达式验证器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net页面上有两个文本框和一个按钮,
两个文本框都具有用于TIME格式的正则表达式验证器
当我单击按钮时,如果时间格式不正确,则会显示错误消息
我的问题,即使时间不正确,button_click事件也可以正常工作
请帮助我

i have a two textboxes and a button in an asp.net page,
both of two textboxes have a regular expression validator for TIME Format
when i click on button,its showing error message if the time format is incorrect
my problem,the button_click event is working even if the time is incorrect or not
Please help me

推荐答案

检查Button的CausesValidation属性是否设置为True.

更新1:
您是否尝试过在文本框中输入一些值(错误值).您的表达式也应该很聪明,可以验证空字符串.

如果有帮助,请将其标记为答案
Check if the CausesValidation property of the Button is set to True.

Update 1:
Have you tried entering some values (wrong value) on the textbox. Your expression should be smart to validate empty strings too.

Mark it as answer if it is helpful


这篇关于ASP.NET中带有按钮的正则表达式验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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