CustomValidator error doesl not show in ValidationSummary

N

Nir Erlich

Hi,

I have a custom validator on my web form among other validators, I am
trying to show all the error messages through a validation summary
control but the custom validation seem to always show its messages
separately.

Any way around it? much appreciates.
 
M

Michael Pearson

I think you need to set the Display to None for that Validator. Then it
will show in the summary.

Michael
 
T

Teemu Keiski

Do you perhaps mean getting the error message in the alert box that is
displayed with ValidationSummary? And if that's the case, does your
CustomValidator do the validation only at server-side?

--
Teemu Keiski
MCP, Designer/Developer

AspInsiders Member, www.aspinsiders.com
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com
 
N

Nir Erlich

that's correct but in fact the only validation I have with the custom
validators is the client side. here is the code:

<asp:customvalidator id="Customvalidator1" Display="None"
ClientValidationFunction="ValidatepageData();" ErrorMessage="Please
choose a reason" Runat="Server"
NAME="Customvalidator1"></asp:customvalidator>
<asp:requiredfieldvalidator id="Requiredfieldvalidator1"
Display="None" ErrorMessage="Please enter a course name"
Runat="Server" NAME="Requiredfieldvalidator1"
ControlToValidate="txtCourseName"></asp:requiredfieldvalidator>
<asp:requiredfieldvalidator id="Requiredfieldvalidator3"
Display="None" ErrorMessage="Please enter the course start date"
Runat="Server" NAME="Requiredfieldvalidator2"
ControlToValidate="txtStart"></asp:requiredfieldvalidator>
<asp:requiredfieldvalidator id="Requiredfieldvalidator4"
Display="None" ErrorMessage="Please enter the course end date"
Runat="Server" NAME="Requiredfieldvalidator2"
ControlToValidate="txtEnd"></asp:requiredfieldvalidator>
<asp:customvalidator id="Customvalidator3" Display="None"
ClientValidationFunction="validDate();" ErrorMessage="Please enter a
valid date" Runat="Server"
NAME="Customvalidator3"></asp:customvalidator>
<asp:customvalidator id="Customvalidator2" Display="None"
ClientValidationFunction="checkDates();" ErrorMessage="Start date
can't be greater then end date" Runat="Server"
NAME="Customvalidator2"></asp:customvalidator>
<asp:requiredfieldvalidator id="Requiredfieldvalidator2"
Display="None" ErrorMessage="Please enter the course duration"
Runat="Server" NAME="Requiredfieldvalidator2"
ControlToValidate="txtCourseDuration"></asp:requiredfieldvalidator>
<asp:rangevalidator id="RangeValidator1" Display="None"
ErrorMessage="Please entere a valid duration value" Runat="server"
ControlToValidate="txtCourseDuration" MinimumValue="0"
MaximumValue="1000" Type="Integer"></asp:rangevalidator>
<asp:validationsummary id="Validationsummary1" Runat="Server"
NAME="Validationsummary1" DisplayMode="List" ShowSummary="False"
ShowMessageBox="True" HeaderText="Please check the
following:"></asp:validationsummary>

I'm thinking of going back to the good old way of validating values
with direct calls to js functions, it's getting a bit silly with all
these validators...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top