Cool! I hope you guys took my tongue in cheek comment lightly. The AJAX release and the controls the team have created are awesome! Thanks for all of the hard work!
UNLESS someone like you cares a whole awful lot, nothing is going to get better. It's not!
I am getting this same exact error. On my local machine, the CalendarExtender is working in all cases.
When I deploy the same code to a server, I am getting the error. Although, it only occurs when the Text attribute of the Textbox is set in the aspx page. If it is not set, the CalendarExtender works OK.
I have tried an iisreset, and I tried reregistering the framework with no luck. I am encountering the issue on a Windows 2000 server if that makes any difference. I also have NOT installed any of the AJAX packages on the server. Is that necessary?
I have all of the appropiate DLLs in my Bin folder of my web application, and all of the other AJAX extensions and Toolkit controls are working OK.
Here is the code that is producing the error:
<!-- this works without any issues -->
<asp:TextBox ID="TextBoxTest1" runat="server" Text=""></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBoxTest1" runat="server"></ajaxToolkit:CalendarExtender>
<!-- this outputs a Javascript error, and the CalendarExtender fails to popup because the Text attribute has a value -->
<asp:TextBox ID="TextBoxTest2" runat="server" Text="10/4/2007"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender2" TargetControlID="TextBoxTest2" runat="server"></ajaxToolkit:CalendarExtender>
<!-- Javascript error in Firefox:
Error: Date.parseLocale is not a function
Line: 1173:
_parseTextValue : function(text) {
/// <summary>
/// Converts a text value from the textbox into a date
/// </summary>
/// <param name="text" type="String" mayBeNull="true">The text value to parse</param>
/// <returns type="Date" />
var value = null;
if(text) {
// LINE 1173 value = Date.parseLocale(text, this.get_format());
}
if(isNaN(value)) {
value = null;
}
return value;
},
-->
Why does the framework need to be installed if the DLLs are included in the web application?
I'm a little confused by this because all of the other parts of the AJAX framework that I have been using are working fine on a server that does not have the framework installed.
I am getting this error, in addition to a similar one (Sys.Debug is undefined), both on a development server and on my local machine when I run the application. I suspect I don't have something configured properly. I'm using reflection to check versions
on an 'about' page, and the following versions are loaded:
Microsoft Ajax version 1.0.61025.0
Ajax Control Toolkit version 1.0.10201.0
Are these the latest versions? Is there something I can do to see which version of the JavaScript library is running- to make sure there isn't a mismatch or caching issue? I can fix the errors with the following code, but this is just a hack to wire up
the missing functions temporarily:
If Not ScriptManager.GetCurrent(Me.Page) Is Nothing Then
If Not Page.ClientScript.IsStartupScriptRegistered("AjaxToolkitTempFix") Then _
Page.ClientScript.RegisterStartupScript(Me.GetType(), "AjaxToolkitTempFix", _
"Date.parseLocale = function(s, f){return Date(s);};" + Environment.NewLine + "Sys.Debug = new Object();Sys.Debug.isDebug = function(){return true};", True)
End If
Thank you Zappenduster all the other solutions to this problem didn't help, but your did.
I understand that this is not quite a delicate solution but it is a good workaround.
I think we should follow up with this problem because I've searched through AJAX ASP.NET and through Ajax Toolkit and never have found the parseLocale method
Hope someone finds an answer to this question and posts it here
Pretty sure this is resolved in the latest version (10301). I had this issue, and had the above fix in place, but no longer needed it after downloading and rebuilding referencing this version.
I've been having the same problem on a development machine. My CalendarExtender will work fine on an ordinary TextBox, but it doesn't work if the TextBox is within a DetailsView. The fix suggested by boatboy and Zappenduster worked for me. I'm running:
AJAX Extensions 1.0.61025.0
Control Toolkit 1.0.10606.0
I managed to locate the real code for Date.parseLocale, which I found (by grepping) in Microsoft.Web.Extensions.dll, file version 1.0.61231.0. This assembly seems to contain an embedded version of MicrosoftAjax.js, but the embedded version contains the parseLocale
code, unlike the versions that are on disk in Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\MicrosoftAjaxLibrary\System.Web.Extensions\1.0.61025.0\Release and ...\Debug.
The code for the parseLocale function looks like this:
I used this code instead of the text in Zappenduster's example, just in case the locale matters when parsing dates (I run UK English settings). It works just fine, but I didn't experiment to see if it's necessary.
the_lorax
Member
293 Points
65 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Feb 02, 2007 10:41 PM|LINK
Cool! I hope you guys took my tongue in cheek comment lightly. The AJAX release and the controls the team have created are awesome! Thanks for all of the hard work!
mr_breaker
Member
320 Points
187 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Feb 05, 2007 09:21 PM|LINK
I am getting this same exact error. On my local machine, the CalendarExtender is working in all cases.
When I deploy the same code to a server, I am getting the error. Although, it only occurs when the Text attribute of the Textbox is set in the aspx page. If it is not set, the CalendarExtender works OK.
I have tried an iisreset, and I tried reregistering the framework with no luck. I am encountering the issue on a Windows 2000 server if that makes any difference. I also have NOT installed any of the AJAX packages on the server. Is that necessary?
I have all of the appropiate DLLs in my Bin folder of my web application, and all of the other AJAX extensions and Toolkit controls are working OK.
Here is the code that is producing the error:
<!-- this works without any issues --> <asp:TextBox ID="TextBoxTest1" runat="server" Text=""></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBoxTest1" runat="server"></ajaxToolkit:CalendarExtender> <!-- this outputs a Javascript error, and the CalendarExtender fails to popup because the Text attribute has a value --> <asp:TextBox ID="TextBoxTest2" runat="server" Text="10/4/2007"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CalendarExtender2" TargetControlID="TextBoxTest2" runat="server"></ajaxToolkit:CalendarExtender> <!-- Javascript error in Firefox: Error: Date.parseLocale is not a function Line: 1173: _parseTextValue : function(text) { /// <summary> /// Converts a text value from the textbox into a date /// </summary> /// <param name="text" type="String" mayBeNull="true">The text value to parse</param> /// <returns type="Date" /> var value = null; if(text) { // LINE 1173 value = Date.parseLocale(text, this.get_format()); } if(isNaN(value)) { value = null; } return value; }, -->sburke_msft
Contributor
4396 Points
770 Posts
Microsoft
Re: New CalendarExtender Error in ScriptResource.axd
Feb 05, 2007 09:44 PM|LINK
mr_breaker
Member
320 Points
187 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Feb 05, 2007 09:47 PM|LINK
Why does the framework need to be installed if the DLLs are included in the web application?
I'm a little confused by this because all of the other parts of the AJAX framework that I have been using are working fine on a server that does not have the framework installed.
jimmiea
Member
2 Points
2 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Feb 15, 2007 02:32 PM|LINK
I'm having the exact same problem.
I have tried to reset IIS and all that but it doesn't help me.
This is how my problem appears:
My calendar works until I do a postback. then it doesn't works any more and I get the following javascript error: Date.parseLocale is not a function
If I clear the textbox the extender is attached to at the postback
tbxDate.Text = string.Empty
then it works! but this isn't how it should work.
someone with any more suggestion?
boatboy
Member
68 Points
35 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Feb 26, 2007 10:48 PM|LINK
I am getting this error, in addition to a similar one (Sys.Debug is undefined), both on a development server and on my local machine when I run the application. I suspect I don't have something configured properly. I'm using reflection to check versions on an 'about' page, and the following versions are loaded:
Microsoft Ajax version 1.0.61025.0
Ajax Control Toolkit version 1.0.10201.0
Are these the latest versions? Is there something I can do to see which version of the JavaScript library is running- to make sure there isn't a mismatch or caching issue? I can fix the errors with the following code, but this is just a hack to wire up the missing functions temporarily:
If Not ScriptManager.GetCurrent(Me.Page) Is Nothing Then
If Not Page.ClientScript.IsStartupScriptRegistered("AjaxToolkitTempFix") Then _
Page.ClientScript.RegisterStartupScript(Me.GetType(), "AjaxToolkitTempFix", _
"Date.parseLocale = function(s, f){return Date(s);};" + Environment.NewLine + "Sys.Debug = new Object();Sys.Debug.isDebug = function(){return true};", True)
End If
Any suggestions?
Zappenduster
Member
4 Points
7 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Apr 13, 2007 07:12 PM|LINK
same situation here. this keeps me from using the control in quite a lot of situations. which is a shame. I wonder if we will have to live with this?
fortunately the hack works, here is a c# version, just put it in page_load
//HACK http://forums.asp.net/2/1595855/ShowThread.aspx if(ScriptManager.GetCurrent(this.Page) != null) { if(!Page.ClientScript.IsStartupScriptRegistered("AjaxToolkitTempFix")) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AjaxToolkitTempFix", "Date.parseLocale = function(s, f){return Date(s);};" + Environment.NewLine + "Sys.Debug = new Object();Sys.Debug.isDebug = function(){return true};", true); } } //--mogoreanu
Member
2 Points
1 Post
Re: New CalendarExtender Error in ScriptResource.axd
Apr 30, 2007 06:20 PM|LINK
Thank you Zappenduster all the other solutions to this problem didn't help, but your did.
I understand that this is not quite a delicate solution but it is a good workaround.
I think we should follow up with this problem because I've searched through AJAX ASP.NET and through Ajax Toolkit and never have found the parseLocale method
Hope someone finds an answer to this question and posts it here
boatboy
Member
68 Points
35 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Apr 30, 2007 09:04 PM|LINK
Pretty sure this is resolved in the latest version (10301). I had this issue, and had the above fix in place, but no longer needed it after downloading and rebuilding referencing this version.
http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425
rich.tebb
Member
12 Points
4 Posts
Re: New CalendarExtender Error in ScriptResource.axd
Jun 19, 2007 01:22 PM|LINK
I've been having the same problem on a development machine. My CalendarExtender will work fine on an ordinary TextBox, but it doesn't work if the TextBox is within a DetailsView. The fix suggested by boatboy and Zappenduster worked for me. I'm running:
AJAX Extensions 1.0.61025.0
Control Toolkit 1.0.10606.0
I managed to locate the real code for Date.parseLocale, which I found (by grepping) in Microsoft.Web.Extensions.dll, file version 1.0.61231.0. This assembly seems to contain an embedded version of MicrosoftAjax.js, but the embedded version contains the parseLocale code, unlike the versions that are on disk in Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\MicrosoftAjaxLibrary\System.Web.Extensions\1.0.61025.0\Release and ...\Debug.
The code for the parseLocale function looks like this:
Date.parseLocale = function Date$parseLocale(value, formats) { /// <param name="value" type="String"></param> /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param> /// <returns type="Date"></returns> var e = Function._validateParams(arguments, [ {name: "value", type: String}, {name: "formats", mayBeNull: true, optional: true, parameterArray: true} ]); if (e) throw e; return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments); }I used this code instead of the text in Zappenduster's example, just in case the locale matters when parsing dates (I run UK English settings). It works just fine, but I didn't experiment to see if it's necessary.