Problem with ASP .NET Ajax Control Toolkit ScriptManager

I havent used the ASP .NET Ajax Control Toolkit in quite a while, on account of concentrating on Silverlight and using JQuery for most of the effects in my applications.  However, I do claim to have knowledge in the Ajax web application space so I do keep myself abreast of all tools.  Helping a colleague at the client site today, I ran into a bit of a snag.  It seems the Control Toolkit team replaced the use of the ScriptManager tag with their own ToolkitScriptManager tag, to facilitate the import of pertinent scripts for its extra controls.  Example:

   1: <form id="form1" runat="server">

   2: <asp:ScriptManager ID="sm" runat="server" />

   3: <div>

   4:     <asp:Label ID="lblDate" runat="server" Text="Date: " />

   5:     <asp:TextBox ID="txtDate" runat="server" />

   6:     <asp:MaskedEditExtender ID="txtDate_MaskedEditExtender" runat="server"

   7:         Enabled="True" TargetControlID="txtDate"

   8:         Mask="99/99/9999" MaskType="Date" />

   9: </div>

  10: </form>

This code will not work with future releases of the Control Toolkit.  The curious thing is, I get the following error when I attempt to run this:

image

Clearly seeing this and you figure out the fix right away, which is to use the ToolkitScriptManager in the place of the normal ScriptManager.  But oddly enough, I did not get this on my colleagues computer.  We got something similar to this:

image

You can see this indicates the Sys.Extend.UI.MaskedEditType.None type is null.  This is still more obvious then what I was receiving on his machine.  Though, I believe that has more to do with him running IE6 without Script Debugging then the Toolkit.  Either way, if you are encountering this problem, the fix is simply to use the ToolkitScriptManager in place of, or in conjunction with, your ScriptManager.

My guess as to the reason for this change is the continuing size increase for the Toolkit.  I can remember when there were about 10 extra controls for it, now its become a whole suite.

   1: <form id="form1" runat="server">

   2: <asp:ToolkitScriptManager ID="tksm" runat="server" />

   3: <div>

   4:     <asp:Label ID="lblDate" runat="server" Text="Date: " />

   5:     <asp:TextBox ID="txtDate" runat="server" />

   6:     <asp:MaskedEditExtender ID="txtDate_MaskedEditExtender" runat="server"

   7:         Enabled="True" TargetControlID="txtDate"

   8:         Mask="99/99/9999" MaskType="Date" />

   9: </div>

  10: </form>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s