views:

1525

answers:

3

Hi,

Is it possible to use the ASP.Net Range validator when the format string is dd/MMM/yyyy? Kind regards,

A: 

No. I think it should be a valid date (without the formatting)

Leon Tayson
+2  A: 

Why don't you use Regular Expression validator?

Alex Reitbort
I highly recommend this method, and this is something I personally do. The only problem, however, is that it will validate against a range of values per date segment. Unless your regex skills are quite good you can't counteract for February.
Kezzer
A: 

ASP.net auto detects the culture info of the client. This info is used to resolve formatting like dates, currency etc.

You can override this with code (something like):

Thread.CurrentThread.CurrentCulture = 
    CultureInfo.CreateSpecificCulture("en-GB");
Thread.CurrentThread.CurrentUICulture =
    new CultureInfo("en-GB");

Or globally in the web.config:

<globalization requestEncoding="utf-8" responseEncoding="utf-8"
    culture="en-GB" uiCulture="en-GB" />

Of course this could have negative/positive side effects on the rest of your application, as it would affect other numbers/dates, but perhaps this is your intent anyway.

HectorMac