473,378 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

String Validation

Hello:

I am trying to validate the length of a string in a text box.

I just need the string to be between 1 - 50.

I have tried RangeValidation and RegularExpressionValidation and everytime I go to test the Validator fires even though the string is in the acceptable range.

Below is the code for my check, both Range and Reg. Ex.

Thanks in advance for your help.

Expand|Select|Wrap|Line Numbers
  1. <td>
  2.                             <asp:TextBox ID="FNameTextBox" runat="server" Text='<%# Bind("FName") %>' />
  3.                         </td>
  4.                         <td>
  5.                             <asp:RangeValidator ID="RangeValidator1" runat="server" 
  6.                                 ControlToValidate="FNameTextBox" ErrorMessage="First Name Too Long" 
  7.                                 MaximumValue="25" MinimumValue="1"></asp:RangeValidator>
  8.                         </td>
  9.  
Expand|Select|Wrap|Line Numbers
  1. <td>
  2.  <asp:TextBox ID="FNameTextBox" runat="server" Text='<%# Bind("FName") %>' />
  3.                         </td>
  4.                         <td>
  5.                             <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
  6.                                 ControlToValidate="FNameTextBox" ErrorMessage="First Name Too Long" 
  7.                                 ValidationExpression="^[a-zA-Z0-9]{25}"></asp:RegularExpressionValidator>
  8.                         </td>
  9.  
Apr 2 '12 #1
1 1573
Sorry. This is actually a ASP.NET issue. Not ASP classic.
Apr 2 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Dave W | last post by:
I wish to validate a string but i'm not quite sure how to go about doing it. I'd like to ensure that it is 9 characters long and in the following format. "LL 00 LLL" - Thats letter, letter,...
11
by: Ray Godfrey | last post by:
Hi there, Just a simple question, I think. I'm writing a program that takes information from a text file and uses that info to query a DB. Sounds simple enough..... The data would look...
0
by: Ray Godfrey | last post by:
Hi there Bob, To answer your questions: 1. I'm using MS SQL Server V8.0 2. Yeah there will be money, date/time data. All the DB will be money/datetime. Its pretty tricky. Using the code...
1
by: Samuel | last post by:
Hello, I am looking for a way to check whether a string contains only word characters and a single space (!= any whitespace char), *regardless of the current locale*. In other words, any...
8
by: jake1138 | last post by:
Maybe this is a newbie thing and everyone already knows how to do this, but I figured I'd post these functions anyway in case someone finds them useful. I used Jack Klein's example (see link...
1
by: R.A. | last post by:
Hi I have the following method: public string FindNameList (string XmlStore) I have a dataset based on xml schema. I have created the schema in vs editor and created the dataset based on...
1
by: OriginalBrownster | last post by:
Hi there: I just had a quick thought of something that might be useful to me when creating my web app and I wanted some help on the idea; since this group has been helpful in the past. in my...
0
by: seyad | last post by:
hai i should allow user to enter a numbers and special charecters into my text box.give me a solution in java script chears seyad
3
by: haji | last post by:
how to validate phone number,age using javascript with html.reply with simple source code .i am well in javascript. give explanation with simple example
3
by: slg | last post by:
How can i validate the characters in a string are all hex chars. I tried following but it does not work. Regex r = new Regex(@"^(||)*"); TIA.
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.