关于asp.net中的自定义验证 [英] About custom validation in asp.net

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

问题描述

嗨 1.我如何进行自定义验证,并且必须给定范围?
2.如果我给出最小范围,它必须显示错误吗?

例如:
给定范围是10,如果我给出5或8,它必须显示错误?

Hi 1. How i do custom validate and it must be given range?
2. if i give minimum range it has to show error?

example:
Given range is 10 if i give 5 or 8 it has to show error?

推荐答案

看看:
使用验证属性添加自定义范围验证 [ CustomValidationAttribute类 [ ^ ].
Have a look:
Adding Custom Range Validation Using Validation Attributes[^]
Also refer: CustomValidationAttribute Class[^] for more.


您可以通过RangeValidator执行此操作,而无需使用CustomValidator.
如果要通过CustomValidator执行它,则:-
I.创建一个函数,将检查白名单范围是否低于10.
二.然后在CustomValidator控件的OnServerValidate属性中调用此函数

祝你好运.
you can perform this action by RangeValidator, no need to use CustomValidator.
if you want to perform it by CustomValidator then:-
I. create a function that will check whethter range is below 10 or not.
II. then call this function in OnServerValidate property of CustomValidator control

best of luck.


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

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