By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,693 Members | 1,936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,693 IT Pros & Developers. It's quick & easy.

Regular Expression Validator and RequiredFieldValidator ???

P: n/a
I have the following problem.
I am using the follwing Regular Expression validator(REV) with validator expressions
^[0-9]{1,2}$
^[a-zA-Z0-9]{3,20}$
The idea of the first exp is 1 or 2 digits
the idea of second expression is username between 3 and 20 chars

When the user enters characters other than the specified REVs are working.
But if the user leaves the textbox without entering anything
Page.IsValid is true which indicates it is not performng any validation.

I read that {n,m} syntax in .net regular expressions is min(n)-max(m)
in the documentation.

Should i also use ReguiredFieldValidator
in addition to regular expression validator

any one facing the same problem.

where is the mistake in me or in .net
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi, S.Kartikeyan,

Yes, you should use a combination of RegularExpressionValidatior and a
RequiredFieldValidator in order to prevent the user from leaving the
associated control blank.

It is mentioned in the Note in the Remarks section:

http://msdn.microsoft.com/library/en...ClassTopic.asp

Greetings
Martin
"S.Kartikeyan" <in*******@yahoo.com> wrote in message
news:6d**************************@posting.google.c om...
I have the following problem.
I am using the follwing Regular Expression validator(REV) with validator expressions ^[0-9]{1,2}$
^[a-zA-Z0-9]{3,20}$
The idea of the first exp is 1 or 2 digits
the idea of second expression is username between 3 and 20 chars

When the user enters characters other than the specified REVs are working.
But if the user leaves the textbox without entering anything
Page.IsValid is true which indicates it is not performng any validation.

I read that {n,m} syntax in .net regular expressions is min(n)-max(m)
in the documentation.

Should i also use ReguiredFieldValidator
in addition to regular expression validator

any one facing the same problem.

where is the mistake in me or in .net

Nov 18 '05 #2

P: n/a
Thanks For your help.
I was wondering where is the mistake.
Microsoft should have designed it the otherway which is more intuitive.

S.Kartikeyan

"Martin Dechev" <de*******@hotmail.com> wrote in message news:<Oc**************@TK2MSFTNGP12.phx.gbl>...
Hi, S.Kartikeyan,

Yes, you should use a combination of RegularExpressionValidatior and a
RequiredFieldValidator in order to prevent the user from leaving the
associated control blank.

It is mentioned in the Note in the Remarks section:

http://msdn.microsoft.com/library/en...ClassTopic.asp

Greetings
Martin
"S.Kartikeyan" <in*******@yahoo.com> wrote in message
news:6d**************************@posting.google.c om...
I have the following problem.
I am using the follwing Regular Expression validator(REV) with validator

expressions
^[0-9]{1,2}$
^[a-zA-Z0-9]{3,20}$
The idea of the first exp is 1 or 2 digits
the idea of second expression is username between 3 and 20 chars

When the user enters characters other than the specified REVs are working.
But if the user leaves the textbox without entering anything
Page.IsValid is true which indicates it is not performng any validation.

I read that {n,m} syntax in .net regular expressions is min(n)-max(m)
in the documentation.

Should i also use ReguiredFieldValidator
in addition to regular expression validator

any one facing the same problem.

where is the mistake in me or in .net

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.