Skip to the content Back to Top

It seems like I just can't find enough gotchas this week. My latest is the use of the ValidationGroup attribute when validating user input in ASP.NET 2.0.

If you use ValidationGroup="Foo" on a validation control, then the postback control (a Submit button, perhaps) must also reference that validation group, or no validation occurs. In hindsight, this is logical and even obvious. Hindsight is always annoyingly obvious. Meanwhilesight, however, had me crossing my eyes in vexation because I couldn't understand why the validation controls simply weren't firing (client-side or server-side).

I had used ValidationGroup on all my validation controls, but had forgotten to reference the group name when I added a button the next day. The .NET can be a harsh mistress.

Comments


Comments are closed

Let Us Help You!

We're Librarians - We Love to Help People