473,398 Members | 2,403 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,398 software developers and data experts.

Checking string's length with validator controls

I need to check the length of a string in a textbox control. I used
RegularExpressionValidator with ".{0,20}" to check if the string is between
0 and 20 characters. Is it possible to use the other validator classes to
check a string's length? I tried RangeValidator but it seems that it checks
for alphabetical order. Thanks for replies.
Nov 17 '05 #1
2 9672
Why not CustomValidator?
--
Dmitry Andreev. MCSD.NET

"Pierre" <pi*************@gmx.net> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
I need to check the length of a string in a textbox control. I used
RegularExpressionValidator with ".{0,20}" to check if the string is between 0 and 20 characters. Is it possible to use the other validator classes to
check a string's length? I tried RangeValidator but it seems that it checks for alphabetical order. Thanks for replies.

Nov 17 '05 #2
In article <e1**************@TK2MSFTNGP10.phx.gbl>, Pierre wrote:
I need to check the length of a string in a textbox control. I used
RegularExpressionValidator with ".{0,20}" to check if the string is between
0 and 20 characters. Is it possible to use the other validator classes to
check a string's length? I tried RangeValidator but it seems that it checks
for alphabetical order. Thanks for replies.


CustomValidator would work, but why not just set the maxlength of the
textbox to 20? (Sure, you'd still need to double-check on the server
side to avoid malicious spoofing, but you don't really need nice
good-looking validator controls for that.)
--
David
dfoster at
hotpop dot com
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: wolfgang haefelinger | last post by:
Greetings, I'm trying to read (japanese) chars from a file. While doing so I encounter that a char with length 2 is returned. Is this to be expected or is there something wrong? Basically...
1
by: Wee | last post by:
String.value.length and String.value doesn't work together in a single function in IE. I've no problem running either of this, but not together at the same time. var...
0
by: Guess | last post by:
I have seen examples that seem to indicate that if we extend a validator, the extended properties must be preserved in ViewState. That seems unnessary to me since we usually will declare the...
1
by: Derrick | last post by:
Is there an official max length for the string (System.String) class? Thanks! Derrick
2
by: CsaaGuy | last post by:
Hi, I have a aspx, vb.net form which i want to use validation controls, but any control that i use automatically disables all my button events and i can't seem to fix that. Thanks for any help.
7
by: darrel | last post by:
I have a function call that passes a value from a dataset field: myFunction(ds.Tables(0).Rows(0)("myField").ToString) The function then receives this: myFunction(ByVal myValue as string) ...
3
by: Howard | last post by:
I use a regex validator to check if a textbox is in email format. How do I make sure zero length input is not accepted? Do I need to use another requiredfield validator? or is check zero length...
26
by: alberto | last post by:
Hi. Im newbie in C language. I have a binary file with many character arrays of 50 character defined as char array But in some cases, many of these 50 characters are not being used. I would...
6
by: Jeff | last post by:
Could someone tell me the easiest way to check a string of variable length to see if it consists of all blank characters? ....or perhaps more generally, to see if all of the characters are the...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.