B
Brendan Reynolds
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?
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?