Validatetextbox: A self-validating TextBox control (with C # source code)

Source: Internet
Author: User
Control

Because many servers do not support validation controls on settings

So the page with the validation control will have problems with the client button not being submitted

Every time you write JS code to verify the data is too troublesome,

Then there is the problem of the textbox itself, when the TextMode property is set to Multiline, the maxlength fails

For the above question, I wrote this inherited from the textbox using JS in the client data validation of the custom control,

It is almost the same as a textbox, except that a set of validation-related attributes are available on the property panel, and the appropriate configuration can achieve the validation you want.

Download Address:
Http://www.thisky.cn/validateTextBox.rar

=============================

The public properties of the Validatetextbox are:

Name: Check
Type: BOOL
Description: Validation is not validated when set to False, all other [validation-related property] settings are invalid, and the control is a normal textbox.


Name: errwarning
Type: BOOL
Description: Validation error prompts, when set to true, pop-up warning box, set to false text basket background change


Name: Errcolor
Type: string
Description: The background color of the text box when validation fails, only valid if Errwarning is set to false.


Name: Submitbutton
Type: string
Description: The ID number of the button associated with the text box, which is not available if the validation fails


Name: Lengthmin
Type: int
Description: The minimum number of characters entered in the text box, set to 0 without limiting the least input


Name: Lengthmax
Type: int
Description: The maximum number of characters entered in the text box, set to 0 without limiting the maximum input


Name: Regularexpressiontype
Type: enum
Description: The regular expression validation of the text box input is not validated when set to none, int is a non-negative integer, date is 1982-08-26 format date, simple only alphanumeric underline, email is e-mail, custom regular expression.


Name: regexsting
Type: string
Description: A custom regular expression that is valid only when Regularexpressiontype is set to custom.


Name: Regexerr
Type: string
Description: Prompts for custom regular expression validation errors, valid only if Regularexpressiontype is set to custom and Errwarning is set to true.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.