views:

32

answers:

2

I am hoping to change the text of a label based on the outcome of a client side validation control. Is there any way to do this using the regular expression validation control?

A: 

Not that I know of directly, but what you can do is override the validation functions for the validators and have that update the label.

This isn't the post I initially found that describes it, but I believe it will point you in the right direction.

Kevin
A: 

Yes, assuming client-side validation is enabled for the Valdiator. There is a client-side API you can hook into to. See this:
http://msdn.microsoft.com/en-us/library/aa479045.aspx

Scroll down and read the "Special Effects" section, which uses a RegularExpressionValidator in the example. Note that it changes the background color rather than changing text in a label, but the main thing is seeing where you can put your own code. Also note that you can't change the server representation of the label. All you can do is normal javascript DOM manipulation.

Joel Coehoorn
This came really close but I haven't been able to change any of the labels in my page. Essentially nothing happen even though the script runs.
ProgrammingPope