Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:29:25+00:00 2026-06-01T17:29:25+00:00

I am using asp.net validations and jquery validation for checking user input.I am using

  • 0

I am using asp.net validations and jquery validation for checking user input.I am using number of required field validators and custom validators in my form , i am facing a strange problem , when a field with required validator is empty , the error message is displayed on validation summary. this is all right.When the same field is left empty and wrong inputs are entered on other fields with custom validators ,, the validation summary only displays the error message of required field validator.The other error messages are just not displayed.Can anybody point me out where am i going wrong.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:29:26+00:00Added an answer on June 1, 2026 at 5:29 pm

    Here is a code sample that uses RequiredFieldValidator together with CustomValidator. It validates both fields, as well as when one of them fails, and displays the error messages in the ValidationSummary.

    The CustomValidator has OnServerValidate function in the code behind.

    The .aspx markup:

                <form id="form1" runat="server">
                    <div>
                        <label>Name:</label>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" EnableClientScript="false"
                        ControlToValidate="TextBox1" ErrorMessage="The 'Name' field cannot be empty!" Text="*" ForeColor="Red" 
                        Display="Dynamic"></asp:RequiredFieldValidator>
    
                        <br /><br />
    
                        <label>Number:</label>
                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ValidateEmptyText="true"
                        ControlToValidate="TextBox2" ErrorMessage="The 'Number' field must be exactly 5 digits!" Text="*" ForeColor="Red" 
                        Display="Dynamic" onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
    
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="Please check the following fields:" ForeColor="Red" DisplayMode="BulletList" />
    
                        <br />
    
                        <asp:Button ID="Button1" runat="server" Text="Submit" />
                    </div>
                </form>
    

    and the validation function in .aspx.cs file:

                protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
                {
                    if (args.Value.Length < 5 || args.Value.Length > 5)
                    {
                        args.IsValid = false;
                    }
                    else
                    {
                        args.IsValid = true;
                    }
                }
    

    In order to be able to display both error messages, and not only the RequiredFieldValidator‘s, its property ‘EnableClientScript’ should be set to false.

    Hopefully, this will get you going and solve your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using asp.net mvc 3 with unobtrusive jquery validation. I have a form that
I'm using jQuery validation in ASP.net MVC. I would like to show validation summary
plz guide me how I can enable or disable asp.net validation controls using jQuery
Using ASP.NET 3.5 and jQuery UI. When a user clicks the Search button, a
When i use use following inline jQuery Based validation in asp.net c# web form
I am using asp.net mvc 2.0 and jquery validate 1.7 ( http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ) What
I am performing both clientside validation and server side validation using jquery and Asp.net
Have: Using ASP.NET MVC 2, DataAnnotationsModel based server validation, and client validation with jQuery.
I'm currently using ASP.NET MVC3 RC and I'm using the unobtrusive JQuery validations as
I'm using asp.net mvc 3 with jquery unobtrusive validation. I recently changed from standard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.