26 September 2011

asp:RegularExpressionValidator not working for initially disabled buttons

Hi all,

I have found an interesting thing or better to say odd behaviour about asp:RegularExpressionValidator and the way it is actioned.

Below I will describe the odd behaviour:
For example you have a form and a field with a RegularExpressionValidator on that field and a asp:Button on that form. So if that button is disabled by default (through asp or in code-behind)  and then it is enabled through JavaScript then you will have a surprise - the RegularExpressionValidator will not be actioned.

The RegularExpressionValidator will work very good when button is disable by default and then is enabled through codebehind.

Conclusion:
Pay attention when disabling/enabling asp buttons through JavaScript.

No comments:

Post a Comment

your thoughts are welcome:

Need more? Leave comments and subscribe to my blog.

.