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

Regular Expressions Problem

P: n/a
Hi,

I am using Visual Studio 2005 and am trying to use a Regular Expression
Validator control.

I have a drop down list which contains various names, the first one is
"Please Select". I want the user to have to select a name other than
'Please Select'.

I am thinking maybe the Regular Expression Validator is the best move
for this. How would i go about telling the Validator that
ddlApprovers.selectedvalue should not equal "Please select".

I have seen articles on writing and compiling your own validators...is
this the only way to do this...or is there some quicker way.

I know i can do this server side but i want something to work client
side.
Thanks...

Mar 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dear kieran,

For the Regular Expression Validator, its propose is checking the
expression, ie email address, combination of characters, phone number...etc

For your propose, I think there are 2 types validator fits your need.
1) Custom Validator
2) CompareValidator.

As you said, you don't want to use Custom one, so you may try to use Compare
Validator. Just compare the value if it is equal to "Please Select", if it
does, erturn false.
--
Hope this help and welcome to reply the testing result.

Regards
Ken Lin, Kam Hung
Founder and VP of Hong Kong .NET User Group(http://HKNetUG.com)
MCP, MCP+I, MCDST, MCSA, MCSE(NT4 & win2k),
MCSE+I, MCDBA(SQL7 & SQL2K), MCSD(VB6 & .NET), MCAD(.NET)
Microsoft Community Star(Hong Kong & Taiwan)
Microsoft Most Valuable Professional(.NET since 2003)
MCT2004 & 2005

"kieran" <ki********@hotmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
Hi,

I am using Visual Studio 2005 and am trying to use a Regular Expression
Validator control.

I have a drop down list which contains various names, the first one is
"Please Select". I want the user to have to select a name other than
'Please Select'.

I am thinking maybe the Regular Expression Validator is the best move
for this. How would i go about telling the Validator that
ddlApprovers.selectedvalue should not equal "Please select".

I have seen articles on writing and compiling your own validators...is
this the only way to do this...or is there some quicker way.

I know i can do this server side but i want something to work client
side.
Thanks...

Mar 21 '06 #2

P: n/a
Hi kieran,

I'm not familiar with VS 2005, but in VS 2003, a Validator control had
an InitialValue property that allowed you to set the Initial text that
would display in a control (in your case, a DropDownList ). This was
ideal to set the Initial text to something like :"Please select"

Using this along a RequiredFieldValidator, the Validator would fail
only if the selected value remains "Please select".

I don't know if this behaviour is the same in VS 2005, but you can
check it out.

http://msdn2.microsoft.com/en-US/lib...tialvalue.aspx

Regards,

Cerebrus.

Mar 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.