ASP.NET CustomValidator

Can you tell me when you will use CustomValidator. For example, I have a text box that accepts user comments. Any reason CustomValidator fits into the script and what other validators can't do or hard to do?

+3
source share
4 answers

CustomValidator is designed to give you the freedom to implement your own validation logic when other validators just don't do what you need to do.

EG: when you need to perform some kind of check that does not actually require user input control (for example, checking the presence of a cookie) or if the control you want to check must follow the input rules that are too involved for other validators.

+1
source

Your question describes the exact reason for using CustomValidator: you use it when existing validators will not do what you need. For example, there is no validator that guarantees that the value in the B text box is between the values ​​in and C. You need to do this in the code in CustomValidator.

+2
source

, - .

CustomValidator , , . , , , , , , .

+1

CustomValidators, , ValidationSummary. , , - , ASP.NET.

0

Source: https://habr.com/ru/post/1706151/


All Articles