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 7722169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:06:09+00:00 2026-06-01T04:06:09+00:00

I succesfully used a validator more than once,but after some programming my validators are

  • 0

I succesfully used a validator more than once,but after some programming my validators are not working.Maybe is something i don’t know about defining 2 validators for the same control, but it doesn’t work for one validator in a control either.Here are 2 examples of my code:

Example 1: one required field validator and one “maximum value” validator for username:

<asp:RequiredFieldValidator id="UsernameRequiredValidator" runat="server"
                                  ControlToValidate="UserNameTextbox" ForeColor="red"
                                  Display="Dynamic"  ErrorMessage="Required" />

<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="UsernameTextbox"  MinimumValue="1" MaximumValue="20"  ForeColor="red"  
    Display="Dynamic"   ErrorMessage="Name must contain maximum 20 characters"></asp:RangeValidator>

Example 2: one “maximum value” validator for roadaddress(string):

 <asp:RangeValidator ID="RangeValidator9" runat="server" MaximumValue="50"  ForeColor="red"
          ErrorMessage="Road Address must contain maxmum 50 characters" ControlToValidate="RoadAddressTextbox"></asp:RangeValidator>

I am thinking that the problem is maybe in the display property or in the causesvalidation property which i don’t use…

  • 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-01T04:06:10+00:00Added an answer on June 1, 2026 at 4:06 am

    That’s not what the RangeValidator is used for. The RangeValidator is intended to check input to make sure it’s within a certain range, i.e. to make sure that a number is between 1 and 5, that a date is within a certain range, etc.

    What you need is a RegularExpressionValidator:

    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
        ControlToValidate="UserNameTextbox"
        ErrorMessage="Username must be between 1 and 50 characters" 
        ValidationExpression="^[a-zA-Z\s]{1,50}">
    </asp:RegularExpressionValidator>
    

    EDIT: Updated expression to ^[a-zA-Z\s]{1,50}

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

Sidebar

Related Questions

This is more of a request for your opinion in something, rather than a
Successfully used jquery-infinite-carousel in the past but for my current project I need it
I have an ASP.NET 3.5 page with some AJAX, some Validators and some business-rule
I do not understand why codeigniter form validator is always returning true. For a
I have successfully used hibernate3-maven-plugin with Hibernate-Core and EntityManager 3.6.6-FINAL, hibernate-commons-annotations-3.2.0.Final, hibernate-jpa-2.0-api-1.0.1.Final and hibernate-validator-4.0.0.GA
I have to delete and rename the files in doPost.but while executing some of
Has anyone successfully used some recent perl_construct/perl_parse/perl_run routines in C pthreads under linux? (solaris?
I developed some JUnit tests that extend org.apache.struts2.StrutsTestCase. I used the tutorial on struts.apache.org
I've successfully used the Windows SendMessage method to help me do various things in
I have successfully used the Excel and Word addin templates in Visual studio 2008

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.