Tags: ajax, aspnet, bug, calendar, error, extender, format, javascript, mmm, net, throwing

Calendar Extender bug using "MMM" in Format.

On .Net » ASP.NET AJAX

8,835 words with 9 Comments; publish: Sun, 06 Jan 2008 01:07:00 GMT; (10078.13, « »)

When using an MMM for the month in the format, javascript is throwing error in post backs.

All Comments

Leave a comment...

  • 9 Comments
    • Not sure quite what you're doing, so it's a little difficult to answer... here's some markup that works fine for me...

      <asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>

      <asp:TextBoxID="DateTextBox"runat="server"/><ajaxToolkit:CalendarExtenderID="CalendarExtender1"runat="server"TargetControlID="DateTextBox"Format="dd MMM yyyy"/>

      I've also tried using Format="MMM" and that works (quite why you'd want to is beyond me!!)

      Which locale are you using for this?? Have you got the latest release of the toolkit which has several bug fixes for the CalendarExtender over the initial RTM release?

      Cheers,

      James

      #1; Sun, 06 Jan 2008 01:08:00 GMT
    • Try adding an ASP Button control.

      Select a date that will show "MMM" format.

      Then from the page click the button to do a Post Back.

      Error message - "Microsoft JScript runtime error: 'length' is null or not an object"

      Bug?

      #2; Sun, 06 Jan 2008 01:09:00 GMT
    • Are we supposed to be psychic?? Rather than making us guess what your problems are, TRY giving us some code/markup to work with... then you might get them solved quicker!

      OK... rant over... I'm guessing that you are doing something like this:

      <%.net-ajax.itags.org. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:TextBox ID="DateTextBox" runat="server" /> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="DateTextBox" Format="MMM" /> <asp:Button runat="server" Text="Postback" /> </div> </form></body></html>

      This worksfor me. In which case I would suggest that you've got the latest version of AJAX and the toolkit and that the old versions are held in the cache on your webserver (try iisreset to fix this).

      #3; Sun, 06 Jan 2008 01:10:00 GMT
    • Actually I also faced the same problem

      But its giving Error only if you set the value for textbox which is used as TargetControl in Calendar Extender

      from code behind

      Actually I found that Its getting Null value for format when u set the value and used format "MMM"

      Its a bug in Toolkit

      Its better to use another format

      #4; Sun, 06 Jan 2008 01:11:00 GMT
    • Once again... it's really hard to help if you don't give an example... and once again, it works fine for me...

      So I've tried to second guess what you're doing and have the following code which works...

      <%.net-ajax.itags.org. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { DateTextBox.Text = DateTime.Today.ToString("MMM"); } }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:TextBox ID="DateTextBox" runat="server" /> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="DateTextBox" Format="MMM" /> <asp:Button runat="server" Text="Postback" /> </div> </form></body></html>

      #5; Sun, 06 Jan 2008 01:12:00 GMT
    • I apologize for not providing a detailed example. However I tried the markup you provided and it did not work for me.

      Now it seems like a setup issue on my part if it worked for you.

      The error i'm getting is ""

      the line of code it is breaking is...

      "....var c=d.length;....." not sure if this will help but "d" is null here.

      I have recently upgraded to the Release version for the AJAX extensions and Toolkit.

      #6; Sun, 06 Jan 2008 01:14:00 GMT
    • Thank you for your patience.

      Indeed downloading the latest toolkit assembly solved the problem!

      #7; Sun, 06 Jan 2008 01:15:00 GMT
    • Going back to the questions in my original post...

      Which locale are you using for this?? Have you got the latest release of the toolkit which has several bug fixes for the CalendarExtender over the initial RTM release?

      #8; Sun, 06 Jan 2008 01:15:00 GMT
    • No worries! Glad you've got it working at last!
      #9; Sun, 06 Jan 2008 01:16:00 GMT