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)