Click here to Skip to main content
15,881,652 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Hi there,

Warm Greetings!

I'm using Range validator, Required field validator & others and getting the error messages accordingly. When I'm trying to put them all in a validation summary it does work but the errors are are also being shown on the validator places, I mean they get repeated. Please how can I show errors only in Validation Summary mitigating all the separate error messages from different validators ?



B.Rgds,
Sunny
Posted

Simple ! Set Display="None" in the Validator tag as:
XML
<p> Name :
<asp:TextBox ID="txtName" runat="server" />&nbsp;
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="you still no add the name !"  Display="None" ControlToValidate="txtName"></asp:RequiredFieldValidator>
</p>


and Validation summary as:
XML
<asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="the all error that meet to is : "></asp:ValidationSummary>
 
Share this answer
 
Comments
Sunny_Kumar_ 10-May-12 3:40am    
Thanks a lot...that just did what I wanted. :)
member60 10-May-12 3:43am    
you are wel come !
Display="None" is the trick.
 
Share this answer
 
Comments
AnvilRanger 30-Jul-15 15:29pm    
Your answer brings nothing new to a questions that is over 3 years old. You are just repeating the information in Solution 2 that has been marked as the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900