Concise ASP.NET Validation Summary

asp.netvalidation

is there any way to get the ASP.NET validation summary control to just display the HeaderText when there is a validation error?

Basically what I want is for just a simple message like "Please complete all fields marked *" to appear next to the submit button. As I'm using "*" for the error message on the validators I don't want these to appear in the summary.

Thanks for any help.

Best Answer

Set each validators Text to "*" and ErrorMessage to an empty string.

<form id="form2" runat="server">
Name:<br />
<asp:TextBox ID="NameTextBox" runat="server" />
<asp:RequiredFieldValidator 
    ID="NameTextBoxRequiredValidator" 
    ControlToValidate="NameTextBox"
    ErrorMessage="" 
    Text="*" 
    runat="server" />
<br />
City:<br />
<asp:TextBox ID="CityTextBox" runat="server" />
<asp:RequiredFieldValidator 
    ID="CityTextBoxRequiredValidator" 
    ControlToValidate="CityTextBox"
    ErrorMessage="" 
    Text="*" 
    runat="server" />
<br />
<asp:Button ID="SubmitButton" Text="Submit" runat="server" />
<hr />
<asp:ValidationSummary 
    ID="valSum" 
    DisplayMode="SingleParagraph" 
    HeaderText="Please complete all fields marked *"
    runat="server" />
</form>