asp.net应用程序中的验证问题 [英] validation problem in asp.net application

查看:82
本文介绍了asp.net应用程序中的验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序的一个文本框中,并且该测试框上有验证,但不是必需的,也不是必填字段,该文本框上的所有验证都可以正常工作,但是当单击前进到下一个按钮"时,它将转到下一页.如果它在不使用必填字段的情况下给出了无效消息,那么我如何才能停止该页面.

in application one text box & there is validation on that test box but it is not require or compulsory field, all validation on that text box are working fine but when click on "Procedd to Next button" it goes on next page. how i can stop that go to next page if its gives invalid message without using Required field.

推荐答案

在后面的代码中添加验证功能.如您所说,文本框值可能是强制性的,也可能不是强制性的.
因此,请根据您的要求编写代码.
Make a validation function at code behind. As you said the textbox value may or may not be mandatory.
So write code as per your requirement.


尝试使用自定义验证器.

http://asp.net-tutorials.com/validation/custom-validator/ [ ^ ]

您可以手动更改is字段是否为必填项,具体取决于您的条件.
try with custom validator.

http://asp.net-tutorials.com/validation/custom-validator/[^]

You can manually changed the is field is mandotaory is not as per your condition.


请确保您不会在该文本框中应用验证组,这就是为什么
请求传输称为...
please insure that you will not apply validation group on that textbox that''s why
request transfer is called...


这篇关于asp.net应用程序中的验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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