Using the ValidationSummary for validators with ErrorMessage set to needed texts, will always show these ErrorMessage texts when the validation fails.
Also, as I noticed, using the ValidationSummary in a long page, will cause an automatic scroll to the first failed field, which is visually a very good way to guide the user in case of data invalidation. Don't know if this is a crossbrowser feature of the ValidationSummary (never checked
), I only needed for IE so far. So, if you want to make use of this intrinsic effect, you have to use ValidationSummary.
It might be the case when you don't want to show all these texts of validators on page, but rather only the HeaderText which could be something generic like "Mandatory fields invalid".
By default, the ValidationSummary control does not allow that. It will always show the error messages collection from the failed fields.
A trick I found out to be working ok, would be to force the ValidationSummary property DisplayMode to "BulletList" and the CssClass to something like "validation_summary_as_bulletlist", where:
So, the ValidationSummary control would look something like:
<asp:ValidationSummary ID="vsSendOrder" ValidationGroup="SendOrder" ShowSummary="true"
CssClass="validation_summary_as_bulletlist" DisplayMode="BulletList" HeaderText="Mandatory fields invalid." runat="server" />
This way, the ValidationSummary will always show its HeaderText but will not show the list of ErrorMessage texts from the failed fields.
Looks like an elegant solution to me, hope you'll find it useful, i'm posting it here because i searched hard to find a solution to this issue, and wasn't able to find one so far
Again, sorry, I do not know if this solution is crossbrowser functional, hope you'll find out and drop me a note about it