ValidationGroup on the ValidationSummary Control
Today I learned an important lesson about the ValidationSummary control. But first, some background.
The bug I was working on was this: the validation summary did not display the validation errors. The page would repost and redisplay, but there was no messaging as to what might be wrong.
The page was set up in a wizard sort of fashion with about three Panel controls that are displayed selectively, depending on which step the user is on. In order to prevent all the validation controls to fire every time a button is clicked, the various validators were assigned to different validation groups, one for each Panel.
It took me about an hour before I discovered this truth:
"When you specify a value for the ValidationSummary property, only
error messages from the validation controls that are part of the specified group
are summarized. If you do not set a value for this property, all error messages
from validation controls on the page that are not assigned to a validation group
are summarized."
The first time I read it, I was in a hurry and didn't catch the very last part: "...that are not assigned to a validation group..." I guess it is important to read all the documentation.
My bug was that the ValidationSummary did not specify a validation group. According to the docs, that means that only validators that are not assigned a ValidationGroup will show up in the summary control. It was an easy fix (set the validation group when I set which panel to display), but it took me about an hour to figure it out.