Question

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

Was it helpful?

Solution

Why don't you use Regular Expression validator?

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top