Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Does CompareValidator work for the date in dd-mmm-yyyy format?

 
Thread Tools Search this Thread
Old 06-10-2005, 07:01 AM   #1
Default Does CompareValidator work for the date in dd-mmm-yyyy format?


Hi,

I wish to validate the date a user has entered against the format
dd-mmm-yyyy
using the CompareValidator, but it does not work.

Does anybody have a simple solution please?

Many thanks in advance.

Regards,
Cyberlotus



=?Utf-8?B?Q3liZXJMb3R1cw==?=
  Reply With Quote
Old 06-10-2005, 07:23 AM   #2
=?Utf-8?B?QmFyZW4=?=
 
Posts: n/a
Default RE: Does CompareValidator work for the date in dd-mmm-yyyy format?
Hi!
I think you can use a RegularExpressionValidator with
ValidationExpression="\d{2}-\d{2}-\d{4}"

Thanks,
Baren

"CyberLotus" wrote:

> Hi,
>
> I wish to validate the date a user has entered against the format
> dd-mmm-yyyy
> using the CompareValidator, but it does not work.
>
> Does anybody have a simple solution please?
>
> Many thanks in advance.
>
> Regards,
> Cyberlotus
>



=?Utf-8?B?QmFyZW4=?=
  Reply With Quote
Old 06-10-2005, 07:57 AM   #3
=?Utf-8?B?Q3liZXJMb3R1cw==?=
 
Posts: n/a
Default RE: Does CompareValidator work for the date in dd-mmm-yyyy format?
Hi Baren,

Thanks for the quick response. But RegularExpressionValidator will validate
the date with the given format.
But I want to compare between 2 dates with the given format.

More elabrately, I have 2 textboxes. One is storing "From date" in
dd-mmm-yyyy format and the other one is storing "To date" in dd-mmm-yyyy
format. Now I want to compare these 2 dates and if "To date" is less than the
"From date" I wish to throw an error.

Please help me in achieving this.

Thanks a lot.

Regards,
Cyberlotus

"Baren" wrote:

> Hi!
> I think you can use a RegularExpressionValidator with
> ValidationExpression="\d{2}-\d{2}-\d{4}"
>
> Thanks,
> Baren
>
> "CyberLotus" wrote:
>
> > Hi,
> >
> > I wish to validate the date a user has entered against the format
> > dd-mmm-yyyy
> > using the CompareValidator, but it does not work.
> >
> > Does anybody have a simple solution please?
> >
> > Many thanks in advance.
> >
> > Regards,
> > Cyberlotus
> >



=?Utf-8?B?Q3liZXJMb3R1cw==?=
  Reply With Quote
Old 06-10-2005, 05:37 PM   #4
Peter Blum
 
Posts: n/a
Default Re: Does CompareValidator work for the date in dd-mmm-yyyy format?
Hi CyberLotus,

The CompareValidator and RangeValidator offer the Type=Date property
setting. However, its limited to "short date patterns". That means the month
is represented by 2 digits, not by text, which is what "mmm" means.

You have two choices:

1. Whenever the built in validators don't do the job, use the
CustomValidator and write the logic yourself. The DateTime.ParseExact()
method will help you convert to the format you want. You probably will have
to live without the client-side version unless you are prepared to do a lot
of javascript coding.

2. My Peter's Date Package (http://www.peterblum.com/datecontrols/home.aspx)
has a DateTextBox that supports the abbreviated month format. You establish
a short date pattern in the xDateTimeFormatInfo property like "dd-MM-yyyy"
and dateseparator = "-". (Note that I wrote two Ns in the short date
pattern). Then you set the xAllowMonthNames property to "Show". (After you
download the free trial version, locate these properties in the User's Guide
for details.)

Next, you use the validators I supply, which includes a Compare validator
for this formatting.

--- Peter Blum
www.PeterBlum.com
Email:
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"CyberLotus" <> wrote in message
news:1B776E4F-B8A0-49CC-9A40-...
> Hi,
>
> I wish to validate the date a user has entered against the format
> dd-mmm-yyyy
> using the CompareValidator, but it does not work.
>
> Does anybody have a simple solution please?
>
> Many thanks in advance.
>
> Regards,
> Cyberlotus
>





Peter Blum
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why No One Wins in the High-Def Format War Ablang DVD Video 50 11-04-2007 04:19 AM
As growth slows, Hollywood faces a DVD standoff. Allan DVD Video 0 07-11-2005 02:10 PM
requesting a hand up - read for your Mom [short message with Quotes] Miss Marple DVD Video 1 03-17-2005 10:07 PM
High Definition and the future of viewing. Allan DVD Video 3 03-09-2005 12:56 AM
NYTimes: Next Video Format robert gray DVD Video 12 01-01-2004 10:42 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46