Sunday, March 1, 2009

Image & Sound in Validator Controls

I am going to give code snippets for a very interesting,to display image or sound instead of validation message in ASP.NET Validation controls.

Displaying image

<asp:requiredfieldvalidator id="reqPercentage" runat="server" errormessage='<img src="image.gif">' controltovalidate="txtPercentage">

for displaying image instead of text we are giving an img tag with src set to a image in our when validation is failed it'll show image instead of text.

Sound in Validation Control

<asp:requiredfieldvalidator id="reqPercentage" runat="server"
bgsound src="sound.wav"
>' controltovalidate="txtPercentage">

And also disable client side script for textbox.Run the application yo'll see the change.


Post a Comment