Use the ASP. NET Ajax-validatorcallout Control

Source: Internet
Author: User
Document directory
  • Introduction
  • Important attributes
  • Example
Introduction

The validatorcallout control is a prompt control used to bind verification controls, so that the display of verification information is more intuitive. As follows:

Important attributes

Targetcontrolid: ID of the verification control to bind
Width: the width of the pop-up prompt.
Highlightcssclass: The style applied to the pop-up prompt information
Warningiconimageurl: Address of the alert image in the pop-up information

Example

1. Open vs2005 and create an ajaxcontroltoolkit website named oec2003_validatorcallout.
2. Open the default. aspx page generated by default and switch to the form view.
3. Drag two Textbox, two requiredfieldvalidator and two validatorcallout controls on the page.
4 two requiredfieldvalidator controls correspond to two Textbox, to verify that the two textbox cannot be empty, and define the error message. These error messages will be displayed through validatorcallout, set the display attribute of requiredfieldvalidator to none. Otherwise, the error message will be displayed in both places. This is what we don't want to see. The Code is as follows:

<Asp: requiredfieldvalidator id = "requiredfieldvalidator1" runat = "server" controltovalidate = "textbox1" display = "NONE" errormessage = "name cannot be blank <br> enter name"> </ASP: requiredfieldvalidator> <br/> password & nbsp; Code: <asp: textbox id = "textbox2" runat = "server" textmode = "password" width = "148px"> </ASP: textbox> <asp: requiredfieldvalidator id = "requiredfieldvalidator2" runat = "server" controltovalidate = "textbox2" display = "NONE" errormessage = "the password cannot be blank. Enter the password"> </ASP: requiredfieldvalidator

5. set two validatorcallout controls to correspond to two requiredfieldvalidator controls. The Code is as follows:

<ajaxtoolkit:validatorcalloutextender id="ValidatorCalloutExtender1" runat="server"     targetcontrolid="RequiredFieldValidator1">     </ajaxtoolkit:validatorcalloutextender> <ajaxtoolkit:validatorcalloutextender id="ValidatorCalloutExtender2" runat="server"     targetcontrolid="RequiredFieldValidator2">     </ajaxtoolkit:validatorcalloutextender>

6. Save the design and run the program. When the form is submitted without entering text in the text box, an error prompt box appears next to the text box, as shown in

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.