|
|
|
start date: Wed, 8 Aug 2007 21:28:06 +0200,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Mark
|
|
2
Göran Andersson
|
|
3
Mark
|
|
4
Göran Andersson
|
|
5
Mark
|
|
6
Alexey Smirnov
|
|
7
Alexey Smirnov
|
|
8
Mark
|
|
9
Alexey Smirnov
|
|
10
Chris
|
|
11
Alexey Smirnov
|
|
12
Alexey Smirnov
|
|
13
Mark
|
date rendered differently on two computers with same regional settings
Hi,
the same application runs independantely on two computers:
the first is an Windows XP prof. sp2 IIS 5.1, dutch version with regional
settings = French (Belgium). So the short date notation is e.g. 13/08/2007.
The date (datetime) in sql server installed on this computer is also
rendered as 13/08/2007.
the second computer is a Windows server 2003 sp2 IIS 6.0, english version
with also regional settings = French (Belgium). So the short date notation
is e.g. 13/08/2007. The date (datetime) in sql server installed on this
computer is also rendered as 13/08/2007.
Sofar no difference.
The application uses a detailsview for showing data and allows updating
data.
The date in the detailsview from the sql server is rendered correctly with
both computers (e.g. 13-08-07 because of the format, see code below).
But now, when clicking on Updating button and the date is e.g. 14-08-07, the
XP computer makes the update without problem, while the server 2003 box
gives the error:"could not convert string to datatime: out-of-range value".
I tried in code-behind with the String.Format("{0:yyyy.MM.dd}", but without
succes
So my questions are:
1) Why does the conversion from a string (data shown in textbox of the
detailsview) to datetime (in sql server) happen properly with XP box and
not with server 2003? The only difference is the language version (dutch for
xp, english for server 2003), but with same regional settings. Are there
different conversion version in function of ... what?
2) what can i do to solve this problem with server 2003?
The code-behind:
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles
DetailsView1.ItemUpdating
.....
e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}", datbeg)
.....
the aspx file:
<asp:SqlDataSource ....
UpdateCommand="UPDATE [mytable] SET [datbeg] = @datbeg">
<UpdateParameters>
<asp:Parameter Name="datbeg" Type="DateTime" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:DetailsView ....>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("datbeg",
"{0:dd-MM-yy}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="begin" SortExpression="datbeg">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("datbeg",
"{0:dd-MM-yy}") %>' ></asp:TextBox>
</EditItemTemplate>
....
I have another example of difference:
sql = "select datbeg from mytable"
.....
dtreader.Read()
datb = dtreader.GetDateTime(0).Date
=> with XP: 13/07/2007
=> with server 2003: 7/13/2007 !!!
Thanks for help
Marc
Date:Wed, 8 Aug 2007 21:28:06 +0200
Author:
|
Re: date rendered differently on two computers with same regional
settings
Mark wrote:
> Hi,
>
> the same application runs independantely on two computers:
> the first is an Windows XP prof. sp2 IIS 5.1, dutch version with regional
> settings = French (Belgium). So the short date notation is e.g. 13/08/2007.
> The date (datetime) in sql server installed on this computer is also
> rendered as 13/08/2007.
>
> the second computer is a Windows server 2003 sp2 IIS 6.0, english version
> with also regional settings = French (Belgium). So the short date notation
> is e.g. 13/08/2007. The date (datetime) in sql server installed on this
> computer is also rendered as 13/08/2007.
>
> Sofar no difference.
Yes, there are differences. It's probably the difference in language
that is the vital difference, but that is not important.
What is important is that you are relying on the regional settings at
all in the web application. The user account that is used to run the web
application is not the same user acount that you have set the regional
settings for, so you don't have control over the regional settings used.
> The application uses a detailsview for showing data and allows updating
> data.
> The date in the detailsview from the sql server is rendered correctly with
> both computers (e.g. 13-08-07 because of the format, see code below).
> But now, when clicking on Updating button and the date is e.g. 14-08-07, the
> XP computer makes the update without problem, while the server 2003 box
> gives the error:"could not convert string to datatime: out-of-range value".
Does that error come from the database or the ASP.NET code?
> I tried in code-behind with the String.Format("{0:yyyy.MM.dd}", but without
> succes
That's on the right way. You should however not convert the date to a
string when you send it to the database. You should use a parameterised
query so that you can send the date as a DateTime value.
>
> So my questions are:
> 1) Why does the conversion from a string (data shown in textbox of the
> detailsview) to datetime (in sql server) happen properly with XP box and
> not with server 2003? The only difference is the language version (dutch for
> xp, english for server 2003), but with same regional settings. Are there
> different conversion version in function of ... what?
It's just not using the settings that you think that it is. That's why
you shouldn't rely on the system settings.
> 2) what can i do to solve this problem with server 2003?
You should specify the culture that you want to use in the web.config,
or for each conversion. Alternatively, you can use specific format
strings, like "dd-MM-yy".
> The code-behind:
>
> Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles
> DetailsView1.ItemUpdating
> ....
> e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}", datbeg)
> ....
>
> the aspx file:
> <asp:SqlDataSource ....
> UpdateCommand="UPDATE [mytable] SET [datbeg] = @datbeg">
> <UpdateParameters>
> <asp:Parameter Name="datbeg" Type="DateTime" />
> </UpdateParameters>
> </asp:SqlDataSource>
>
> <asp:DetailsView ....>
> <ItemTemplate>
> <asp:Label ID="Label1" runat="server" Text='<%# Bind("datbeg",
> "{0:dd-MM-yy}") %>'></asp:Label>
> </ItemTemplate>
> </asp:TemplateField>
>
> <asp:TemplateField HeaderText="begin" SortExpression="datbeg">
> <EditItemTemplate>
> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("datbeg",
> "{0:dd-MM-yy}") %>' ></asp:TextBox>
> </EditItemTemplate>
> ...
>
> I have another example of difference:
>
> sql = "select datbeg from mytable"
> ....
> dtreader.Read()
> datb = dtreader.GetDateTime(0).Date
Here you are using an automatic conversion from DateTime to String. You
should do the conversions explicitly, so that you have control over when
they occur and what culture they use.
> => with XP: 13/07/2007
> => with server 2003: 7/13/2007 !!!
>
> Thanks for help
> Marc
>
>
--
Gran Andersson
_____
http://www.guffa.com
Date:Wed, 08 Aug 2007 22:57:10 +0200
Author:
|
Re: date rendered differently on two computers with same regional settings
Hi, thanks for replying
It's an asp.net error ("Server error in application ....)
And, as you can see in the code, i use parameter in the Update command.
In the code-behind, i did:
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles
DetailsView1.ItemUpdating
Dim datbeg As Date
datbeg = e.NewValues("datbeg")
e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}", datbeg)
you have an idea what to change here?
"Gran Andersson" schreef in bericht
news:eGTd46f2HHA.4004@TK2MSFTNGP05.phx.gbl...
> Mark wrote:
>> Hi,
>>
>> the same application runs independantely on two computers:
>> the first is an Windows XP prof. sp2 IIS 5.1, dutch version with regional
>> settings = French (Belgium). So the short date notation is e.g.
>> 13/08/2007. The date (datetime) in sql server installed on this computer
>> is also rendered as 13/08/2007.
>>
>> the second computer is a Windows server 2003 sp2 IIS 6.0, english version
>> with also regional settings = French (Belgium). So the short date
>> notation is e.g. 13/08/2007. The date (datetime) in sql server installed
>> on this computer is also rendered as 13/08/2007.
>>
>> Sofar no difference.
>
> Yes, there are differences. It's probably the difference in language that
> is the vital difference, but that is not important.
>
> What is important is that you are relying on the regional settings at all
> in the web application. The user account that is used to run the web
> application is not the same user acount that you have set the regional
> settings for, so you don't have control over the regional settings used.
>
>> The application uses a detailsview for showing data and allows updating
>> data.
>> The date in the detailsview from the sql server is rendered correctly
>> with both computers (e.g. 13-08-07 because of the format, see code
>> below).
>> But now, when clicking on Updating button and the date is e.g. 14-08-07,
>> the XP computer makes the update without problem, while the server 2003
>> box gives the error:"could not convert string to datatime: out-of-range
>> value".
>
> Does that error come from the database or the ASP.NET code?
>
>> I tried in code-behind with the String.Format("{0:yyyy.MM.dd}", but
>> without succes
>
> That's on the right way. You should however not convert the date to a
> string when you send it to the database. You should use a parameterised
> query so that you can send the date as a DateTime value.
>
>>
>> So my questions are:
>> 1) Why does the conversion from a string (data shown in textbox of the
>> detailsview) to datetime (in sql server) happen properly with XP box and
>> not with server 2003? The only difference is the language version (dutch
>> for xp, english for server 2003), but with same regional settings. Are
>> there different conversion version in function of ... what?
>
> It's just not using the settings that you think that it is. That's why you
> shouldn't rely on the system settings.
>
>> 2) what can i do to solve this problem with server 2003?
>
> You should specify the culture that you want to use in the web.config, or
> for each conversion. Alternatively, you can use specific format strings,
> like "dd-MM-yy".
>
>> The code-behind:
>>
>> Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e
>> As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles
>> DetailsView1.ItemUpdating
>> ....
>> e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}", datbeg)
>> ....
>>
>> the aspx file:
>> <asp:SqlDataSource ....
>> UpdateCommand="UPDATE [mytable] SET [datbeg] = @datbeg">
>> <UpdateParameters>
>> <asp:Parameter Name="datbeg" Type="DateTime" />
>> </UpdateParameters>
>> </asp:SqlDataSource>
>>
>> <asp:DetailsView ....>
>> <ItemTemplate>
>> <asp:Label ID="Label1" runat="server" Text='<%# Bind("datbeg",
>> "{0:dd-MM-yy}") %>'></asp:Label>
>> </ItemTemplate>
>> </asp:TemplateField>
>>
>> <asp:TemplateField HeaderText="begin" SortExpression="datbeg">
>> <EditItemTemplate>
>> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("datbeg",
>> "{0:dd-MM-yy}") %>' ></asp:TextBox>
>> </EditItemTemplate>
>> ...
>>
>> I have another example of difference:
>>
>> sql = "select datbeg from mytable"
>> ....
>> dtreader.Read()
>> datb = dtreader.GetDateTime(0).Date
>
> Here you are using an automatic conversion from DateTime to String. You
> should do the conversions explicitly, so that you have control over when
> they occur and what culture they use.
>
>> => with XP: 13/07/2007
>> => with server 2003: 7/13/2007 !!!
>>
>> Thanks for help
>> Marc
>
>
> --
> Gran Andersson
> _____
> http://www.guffa.com
Date:Wed, 8 Aug 2007 23:22:34 +0200
Author:
|
Re: date rendered differently on two computers with same regional
settings
Mark wrote:
> Hi, thanks for replying
>
> It's an asp.net error ("Server error in application ....)
Yes, but where does the error message originate? What is the type of the
exception?
> And, as you can see in the code, i use parameter in the Update command.
Then make sure that you set the value as a DateTime value, not as a string.
> In the code-behind, i did:
> Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles
> DetailsView1.ItemUpdating
>
> Dim datbeg As Date
> datbeg = e.NewValues("datbeg")
> e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}", datbeg)
>
> you have an idea what to change here?
e.NewValues("datbeg") = datbeg
--
Gran Andersson
_____
http://www.guffa.com
Date:Wed, 08 Aug 2007 23:36:46 +0200
Author:
|
Re: date rendered differently on two computers with same regional settings
This is the complete message i get:
Server Error in '/myappl' Application.
--------------------------------------------------------------------------------
Conversion from string "13-08-07" to type 'Date' is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from string
"13-08-07" to type 'Date' is not valid.
Source Error:
Line 17: datbeg = e.NewValues("datbeg")
Line 18: datend = e.NewValues("datend")
Line 19: lec2 = e.NewValues("lector2")
Line 20: e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}",
datbeg)
Source File: C:\Inetpub\wwwroot\myapp\test.aspx.vb Line: 18
Stack Trace:
[InvalidCastException: Conversion from string "13-08-07" to type 'Date' is
not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions.ToDate(String Value)
+222
Microsoft.VisualBasic.CompilerServices.Conversions.ToDate(Object Value)
+175
wijzig.DetailsView1_ItemUpdating(Object sender,
DetailsViewUpdateEventArgs e) in
C:\Inetpub\wwwroot\enquetesql\wijzig.aspx.vb:18
System.Web.UI.WebControls.DetailsView.OnItemUpdating(DetailsViewUpdateEventArgs
e) +133
System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg,
Boolean causesValidation) +716
System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +461
System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source,
EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
EventArgs e) +109
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +163
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
"Gran Andersson" schreef in bericht
news:O4z4ARg2HHA.5380@TK2MSFTNGP04.phx.gbl...
Date:Thu, 9 Aug 2007 10:05:56 +0200
Author:
|
Re: date rendered differently on two computers with same regional settings
On Aug 9, 10:05 am, "Mark" wrote:
> This is the complete message i get:
>
> Server Error in '/myappl' Application.
> --------------------------------------------------------------------------------
>
> Conversion from string "13-08-07" to type 'Date' is not valid.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.InvalidCastException: Conversion from string
> "13-08-07" to type 'Date' is not valid.
>
> Source Error:
>
> Line 17: datbeg = e.NewValues("datbeg")
> Line 18: datend = e.NewValues("datend")
> Line 19: lec2 = e.NewValues("lector2")
> Line 20: e.NewValues("datbeg") = String.Format("{0:yyyy.MM.dd}",
> datbeg)
>
> Source File: C:\Inetpub\wwwroot\myapp\test.aspx.vb Line: 18
>
> Stack Trace:
>
> [InvalidCastException: Conversion from string "13-08-07" to type 'Date' is
> not valid.]
Just a quick though on this,
try to use ParseExact
yourdateobj = DateTime.ParseExact("13-08-07", "dd-MM-yy",
System.Globalization.CultureInfo.InvariantCulture)
or use an appropriate culture
Date:Thu, 09 Aug 2007 01:57:25 -0700
Author:
|
Re: date rendered differently on two computers with same regional settings
On Aug 8, 9:28 pm, "Mark" wrote:
> => with XP: 13/07/2007
> => with server 2003: 7/13/2007 !!!
>
try in the web.config
<globalization culture="fr-BE" uiCulture="fr-BE" />
Date:Thu, 09 Aug 2007 02:00:08 -0700
Author:
|
Re: date rendered differently on two computers with same regional settings
Yes, thanks, it works ... if i remove the existing compare validator like
this:
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToValidate="textbox7" text="this is not a valid
date"
Type=Date Operator=DataTypeCheck >
</asp:CompareValidator>
The compare validator doesn't recognize the date "13-08-07" as valid.
When i remove it, it works. Is this a bug?
But now, when a user types a real wrong date (like 31-09-07 or just text),
he gets "the string was not a recognize as a valid datetime". Any way to
prevent that error?
Thanks
"Alexey Smirnov" schreef in bericht
news:1186650008.165566.265270@19g2000hsx.googlegroups.com...
> On Aug 8, 9:28 pm, "Mark" wrote:
>> => with XP: 13/07/2007
>> => with server 2003: 7/13/2007 !!!
>>
>
> try in the web.config
>
> <globalization culture="fr-BE" uiCulture="fr-BE" />
>
Date:Thu, 9 Aug 2007 11:41:32 +0200
Author:
|
Re: date rendered differently on two computers with same regional settings
On Aug 9, 11:41 am, "Mark" wrote:
> Yes, thanks, it works ... if i remove the existing compare validator like
> this:
>
> <asp:CompareValidator ID="CompareValidator1" runat="server"
> ControlToValidate="textbox7" text="this is not a valid
> date"
> Type=Date Operator=DataTypeCheck >
> </asp:CompareValidator>
>
> The compare validator doesn't recognize the date "13-08-07" as valid.
> When i remove it, it works. Is this a bug?
Because I think the format "dd-MM-yy" is not a valid one for Belgium.
You said, the short date notation on your box is "13/08/2007", so the
control expects to get the date in "dd/MM/yy". If you want to have a
dash as a separator then you have to use the
RegularExpressionValidator Control (expression would be similar to
^\d{1,2}\-\d{1,2}\/\d{2}$
will work for
1-8-07
13-08-07
> But now, when a user types a real wrong date (like 31-09-07 or just text),
> he gets "the string was not a recognize as a valid datetime". Any way to
> prevent that error?
>
You could wrap the call in a Try..Catch to catch a format error
Try
yourdateobj = DateTime.ParseExact("13-08-07", "dd-MM-yy",
System.Globalization.CultureInfo.InvariantCulture)
Catch ex As Exception
yourdateobj = Nothing
End Try
Also you can use TryParse() or TryParseExact()
DateTime.TryParseExact("13-08-07", "dd-MM-yy",
CultureInfo.InvariantCulture, DateTimeStyles.None, yourdateobj)
And you can use Regex
Dim yourdateobj As DateTime
Dim regDate As New System.Text.RegularExpressions.Regex("^\d{1,2}\-
\d{1,2}\/\d{2}$")
If regDate.IsMatch("13-08-07") Then
yourdateobj = Date.Parse("13-08-07")
End If
Date:Thu, 09 Aug 2007 03:18:36 -0700
Author:
|
Re: date rendered differently on two computers with same regional settings
Thanks.
Ideal would be to use the compare validator with operator=DataTypeCheck".
The short notation on the computer is d/MM/yyyy.
So I changed the format into: Bind("datbeg", {0:d/MM/yyyy}")
but the compare validator still ignores it when typing e.g. 31/09/2007
Instead of getting the message of the compare validator ("your date in
invalid"), i get the whole error "string was not recognized as ...."
Do you think it's possible to use compare validator?
"Alexey Smirnov" schreef in bericht
news:1186654716.698623.99890@q75g2000hsh.googlegroups.com...
> On Aug 9, 11:41 am, "Mark" wrote:
>> Yes, thanks, it works ... if i remove the existing compare validator like
>> this:
>>
>> <asp:CompareValidator ID="CompareValidator1" runat="server"
>> ControlToValidate="textbox7" text="this is not a valid
>> date"
>> Type=Date Operator=DataTypeCheck >
>> </asp:CompareValidator>
>>
>> The compare validator doesn't recognize the date "13-08-07" as valid.
>> When i remove it, it works. Is this a bug?
>
> Because I think the format "dd-MM-yy" is not a valid one for Belgium.
> You said, the short date notation on your box is "13/08/2007", so the
> control expects to get the date in "dd/MM/yy". If you want to have a
> dash as a separator then you have to use the
> RegularExpressionValidator Control (expression would be similar to
>
> ^\d{1,2}\-\d{1,2}\/\d{2}$
>
> will work for
>
> 1-8-07
> 13-08-07
>
>
>> But now, when a user types a real wrong date (like 31-09-07 or just
>> text),
>> he gets "the string was not a recognize as a valid datetime". Any way to
>> prevent that error?
>>
>
> You could wrap the call in a Try..Catch to catch a format error
>
> Try
> yourdateobj = DateTime.ParseExact("13-08-07", "dd-MM-yy",
> System.Globalization.CultureInfo.InvariantCulture)
> Catch ex As Exception
> yourdateobj = Nothing
> End Try
>
> Also you can use TryParse() or TryParseExact()
>
> DateTime.TryParseExact("13-08-07", "dd-MM-yy",
> CultureInfo.InvariantCulture, DateTimeStyles.None, yourdateobj)
>
> And you can use Regex
>
> Dim yourdateobj As DateTime
> Dim regDate As New System.Text.RegularExpressions.Regex("^\d{1,2}\-
> \d{1,2}\/\d{2}$")
> If regDate.IsMatch("13-08-07") Then
> yourdateobj = Date.Parse("13-08-07")
> End If
>
Date:Thu, 9 Aug 2007 15:30:47 +0200
Author:
|
Re: date rendered differently on two computers with same regional settings
On Aug 9, 3:30 pm, "Chris" wrote:
> Thanks.
> Ideal would be to use the compare validator with operator=DataTypeCheck".
>
> The short notation on the computer is d/MM/yyyy.
> So I changed the format into: Bind("datbeg", {0:d/MM/yyyy}")
> but the compare validator still ignores it when typing e.g. 31/09/2007
> Instead of getting the message of the compare validator ("your date in
> invalid"), i get the whole error "string was not recognized as ...."
>
> Do you think it's possible to use compare validator?
>
Because 31/09/2007 doesn't exist. The month of September has 30
days :-)
Date:Thu, 09 Aug 2007 06:59:57 -0700
Author:
|
Re: date rendered differently on two computers with same regional settings
On Aug 9, 3:59 pm, Alexey Smirnov wrote:
> > but the compare validator still ignores it when typing e.g. 31/09/2007
> > Instead of getting the message of the compare validator ("your date in
> > invalid"), i get the whole error "string was not recognized as ...."
>
This:
<asp:textbox id="TextBox1" runat=server columns="45" Width="125px"></
asp:textbox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="your date invalid"
Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
<asp:Button id="Button1" text="Submit" runat="server" />
gives me the message from validator: "your date invalid" even I typed
a wrong text.
So, I guess that "string was not recognized as ...." returned in your
case in the code-behind class and not by the validator control
Date:Thu, 09 Aug 2007 07:04:30 -0700
Author:
|
Re: date rendered differently on two computers with same regional settings
Ok, thanks.
"Alexey Smirnov" schreef in bericht
news:1186668270.212472.225980@22g2000hsm.googlegroups.com...
> On Aug 9, 3:59 pm, Alexey Smirnov wrote:
>> > but the compare validator still ignores it when typing e.g. 31/09/2007
>> > Instead of getting the message of the compare validator ("your date in
>> > invalid"), i get the whole error "string was not recognized as ...."
>>
>
> This:
>
> <asp:textbox id="TextBox1" runat=server columns="45" Width="125px"></
> asp:textbox>
> <asp:CompareValidator ID="CompareValidator1" runat="server"
> ControlToValidate="TextBox1" ErrorMessage="your date invalid"
> Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
> <asp:Button id="Button1" text="Submit" runat="server" />
>
> gives me the message from validator: "your date invalid" even I typed
> a wrong text.
>
> So, I guess that "string was not recognized as ...." returned in your
> case in the code-behind class and not by the validator control
>
Date:Thu, 9 Aug 2007 18:59:17 +0200
Author:
|
|
|