Use image and sound (errormessage) during verification)

Source: Internet
Author: User
In general verification controls, the value of the errormessage attribute is a general string. When a special user needs an image or sound to prompt an error, sometimes the effect is better than a simple character,
Generally, the errormessage attribute is used: Errormessage = "Enter characters in textbox1" 1 < ASP: textbox ID = "Textbox1" Runat = "Server" > </ ASP: textbox >
2 < ASP: textbox ID = "Textbox2" Runat = "Server" > </ ASP: textbox >
3 < ASP: requiredfieldvalidator ID = "Requiredfieldvalidator1" Controltovalidate = "Textbox1" Runat = "Server"  Errormessage= "Enter characters in textbox1"> </ ASP: requiredfieldvalidator >
4 < ASP: button Runat = "Server" ID = "Haha" Text = "Submit"   />

If you want to use an image, use the following method: errormessage. = ' SRC = "Images/cai.jpg" > </ A > ' 1 < ASP: textbox ID = "Textbox1" Runat = "Server" > </ ASP: textbox >
2 < ASP: textbox ID = "Textbox2" Runat = "Server" > </ ASP: textbox >
3 < ASP: requiredfieldvalidator ID = "Requiredfieldvalidator1" Controltovalidate = "Textbox1" Runat = "Server" Errormessage = ' SRC = "Images/cai.jpg" > </ A > '> </ ASP: requiredfieldvalidator >
4 < ASP: button Runat = "Server" ID = "Haha" Text = "Submit"   />

Note the use of single quotes and double quotes
The same is true if sound is used. 1   < ASP: textbox ID = "Textbox1" Runat = "Server" > </ ASP: textbox >
2 < ASP: textbox ID = "Textbox2" Runat = "Server" > </ ASP: textbox >
3 < ASP: requiredfieldvalidator ID = "Requiredfieldvalidator1" Controltovalidate = "Textbox1" Runat = "Server" Errormessage = '<Bgsound SRC = "E: \ vs2005first \ website3 \ music \ mta_007.wav" Loop = "1" > 'Enableclientscript = "false"> </ ASP: requiredfieldvalidator >
4 < ASP: button Runat = "Server" ID = "Haha" Text = "Submit"   />

Different from inserting an image, you need to disable the script. Otherwise, no matter the verification is not verified, the page loaded will have a background sound, so you can add enableclientscript = "false" and it will be OK.
There is also a method for inserting background sound, but it is not often used

(For. net2.0)

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.