473,503 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Range validation and international date formats

In an ASP.NET 1.1 app I have the following range validation control. This is
an intranet app that will be used only within Ireland, so all date input is
expected to be in dd/mm/yyyy format.

<asp:RangeValidator id="varngRollCallDate" runat="server"
ErrorMessage="Please enter a valid date in 'dd/mm/yyyy' format."
ControlToValidate="txtDate" Display="Dynamic" Type="Date"
MinimumValue="01/01/2006" MaximumValue="31/12/2006"
EnableClientScript="True"></asp:RangeValidator>

On my development PC (Windows XP Pro SP2, locale = English (Ireland), short
date format = dd/mm/yyyyy) this works as expected, accepting dates in
dd/mm/yyyy format between 1st January 2006 and 31st December 2006. But on a
server running Windows Server 2003, same locale and date format, loading the
page throws a System.Web.HttpException complaining that the value
'31/12/2006' can not be converted to type Date. If I change the Maximum
Value property to '12/31/2006' the exception is no longer thrown, so it
appears that on the server the validation control is expecting US
'mm/dd/yyyy' date format.

What do I need to do to have the validation control use dd/mm/yyyy format on
the server?

--
Brendan Reynolds
Oct 4 '06 #1
1 4678

Adding the following page directive fixed it ...

culture="en-IE"

I'm still a little puzzled though, as to why adding the page directive
worked, while adding the culture attribute to the globalization section of
web.config didn't?

--
Brendan Reynolds

"Brendan Reynolds" <br******@discussions.microsoft.comwrote in message
news:uB**************@TK2MSFTNGP06.phx.gbl...
In an ASP.NET 1.1 app I have the following range validation control. This
is an intranet app that will be used only within Ireland, so all date
input is expected to be in dd/mm/yyyy format.

<asp:RangeValidator id="varngRollCallDate" runat="server"
ErrorMessage="Please enter a valid date in 'dd/mm/yyyy' format."
ControlToValidate="txtDate" Display="Dynamic" Type="Date"
MinimumValue="01/01/2006" MaximumValue="31/12/2006"
EnableClientScript="True"></asp:RangeValidator>

On my development PC (Windows XP Pro SP2, locale = English (Ireland),
short date format = dd/mm/yyyyy) this works as expected, accepting dates
in dd/mm/yyyy format between 1st January 2006 and 31st December 2006. But
on a server running Windows Server 2003, same locale and date format,
loading the page throws a System.Web.HttpException complaining that the
value '31/12/2006' can not be converted to type Date. If I change the
Maximum Value property to '12/31/2006' the exception is no longer thrown,
so it appears that on the server the validation control is expecting US
'mm/dd/yyyy' date format.

What do I need to do to have the validation control use dd/mm/yyyy format
on the server?

--
Brendan Reynolds

Oct 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3881
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
2
13730
by: seigo | last post by:
I use datetime condition in sql-query. For example: select something from sometable where date between '06/15/04 00:00:00' and '06/15/04 23:59:59' and result on two synchronized servers is...
14
1697
by: milkyway | last post by:
Hello, Is there a good validation package out there that can be used with javascript? I have tried the one here: http://www.peterbailey.net/fValidate/ but had some problems implementing it...
7
2897
by: cc900630 | last post by:
Hi , Anyone have code or can help me write a function to test dates that are : 1) valid dates 2) in the format dd/mm/yy It only needs to work in IE6 and doesnt need to be modified for any...
4
3985
by: Vladislav Moltchanov | last post by:
I try to use MS Access application as data entry/verification tool in a multi-centre international project, where each centre uses this application for local project management and data...
4
1962
by: Fraggle | last post by:
Hi, I want to validate a text box, The user can leave it blank, or fill it in. If they fill it in then it must be a date within a certain range. How can I achieve this? Thank you very much
3
8692
by: pmarisole | last post by:
The following javascript code gives me the date validation that I need except after the correct date is entered into the field, it puts the date in the wrong format EXAMPLE: User enters...
6
2331
by: tatata9999 | last post by:
Hi all, I have this simple time management tool designed and developed. And based on a very thoughtful and kind Frenchman's input I've extended its support to international (support all time...
5
2103
by: maz77 | last post by:
I'm trying to develop a good validation for a date in C#; a valid date can be inserted in these formats: - dd/mm/yyyy - dd/mm/yyyy h24:m - mm/dd/yyyy - mm/dd/yyyy h12:m How can I proceed? Is...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.