Hi Jeff,
The CompareValidator will follow the CultureInfo object defined on the
current thread of the page. For example, <@Page Culture="en-GB" >. But it
only supports the DateTimeFormatInfo.ShortDatePattern which never uses MMM,
only MM or M.
My "Peter's Date Package" (
http://www.peterblum.com/datecontrols/home.aspx)
can handle this. It's DateTextBox (which includes a fancy popup calendar)
can be set to allow the abbreviated month name. Download the free trial
version and set it up with these settings:
1. Create a DateTimeFormatInfo object and assign it to the
DateTextBox.xDateTimeFormatInfo property. See page 34 of the User's Guide.
Set the DateTimeFormatInfo.ShortDatePattern to "dd-MM-yyyy" and
DateTimeFormatInfo.DateSeparator = "-".
2. Set the xAllowMonthNames property to "Show"
3. Peter's Date Package includes its own validator, DateTextBoxValidator,
that will handle this unusual format. So use it for validation.
--- Peter Blum
www.PeterBlum.com
Email:
PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Jeff Knuckey" <je**********@asggroup.com.au> wrote in message
news:63**************************@posting.google.c om...
Peter,
Is it possible to have the MS compare validator properly check a date
in the format dd-MMM-yyyy either by configuration or extension of the
standard controls? I see a lot of people are using dd/MM/yyyy,
mm/dd/yyyy or even yyyy/mm/dd but we would like to encourage users to
use a format that cannot be confused as to date order
"Peter Blum" <PL****@Blum.info> wrote in message
news:<e1**************@TK2MSFTNGP14.phx.gbl>... Several ideas:
1. Use the DateTime object included with .net (which is the underlying
code
to IsDate). Call its Parse or ParseExact methods. (See the .net docs for
details). They will throw exceptions when they cannot parse.
2. Seriously, use a validator! The CompareValidator with
Operator=DataTypeCheck and Type=Date will do the job and provide
client-side
validation.
3. Use a third party date textbox that already has the functionality (and
so
much more, like a popup calendar). You can find them on www.asp.net
Control
Gallery, www.123aspx.com and www.411asp.net. I am the author of one,
"Peter's Date Package" (http://www.peterblum.com/datecontrols/home.aspx).
It
includes a popup calendar, keyboard filtering and reformatting, extended
validators, and time entry controls.
--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Nita Raju" <ni*******@hotmail.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl... > Hi,
>
> I have to validate a textbox for date without using the validation
> controls. So i had to use IsDate(). It's not working properly when i
> give
> "11//2004". When i enter the above date it returns true.
> What can i do about it??
>
> Regards,
> Nita
>
>
>