CustomValidator for ASP. NET verification controls

Source: Internet
Author: User

CustomValidator is a user-defined verification control that responds to user-defined verification. It can be a JS client function, or a server verification function written in the background code. The following describes the background color of CustomValidator. ClientValidationFunction specifies the name of the custom client script function used for verification. Note: The script must be written in a language supported by the browser. For example, if VBScript or JScript uses VBScript, the function must be in the form: Sub FunctionName (source, arguments) using JScript, the Function must be in the form: Function FunctionName (source, arguments) ControlToValidate id of the input control to be verified. Display verifies the Display behavior of error messages in the control. Valid values: · None-the verification message is never displayed inline. · Static-allocate space in the page layout for displaying verification messages. · Dynamic-If verification fails, the space used to display verification messages is dynamically added to the page. A boolean value of EnableClientScript, indicating whether to enable client verification. A boolean value of Enabled, indicating whether to enable the verification control. The error message text displayed in the ValidationSummary control when ErrorMessage verification fails. Note: If the ErrorMessage attribute is set but the Text attribute is not set, the value of the ErrorMessage attribute is also displayed in the verification control. The foreground color of the ForeColor control. The unique id of the id control. A boolean value of IsValid, indicating whether the associated input control has passed verification. OnServerValidate specifies the name of The Script Function executed on the server. Runat specifies that the control is a server control. Must be set to "server ". Text displayed when verification fails. Learn how to use CustomValidator [html] <% @ Page Language = "C #" AutoEventWireup = "true" Inherits = "Default2" Codebehind = "Default2.aspx. cs "%> <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head runat =" server "> <title> Custom Controls </title> <script type =" text/javascript "language =" javascript "> function Clientv (s, e) {e. isValid = (e. value = "client ");} </script>

Related Article

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.