Sunday, March 11, 2012

1.0.10618 breaks BasicDatePicker

I should expand on that by saying that when I say "broken" I mean that clicking on the image to bring up the date picker no longer does anything. No javascript errors, no scripts failing to load (according to Firebug), nothing..


Changing back to using <asp:ScriptManager> fixes it. Not even setting CombineScripts="false" when using the ToolkitScriptManager works... somethings clearly broken!

For completeness the section of code that I'm using for the ToolkitScriptManager is (CombineScripts setting makes no difference) :

<ajaxToolkit:ToolkitScriptManagerID="scriptManager"runat="server"EnablePartialRendering="true"EnablePageMethods="true"ScriptMode="Release"AllowCustomErrorsRedirect="true"CombineScripts="false"></ajaxToolkit:ToolkitScriptManager>

Changing to the following works:

<asp:ScriptManagerID="scriptManager"runat="server"EnablePartialRendering="true"EnablePageMethods="true"ScriptMode="Release"AllowCustomErrorsRedirect="true"></asp:ScriptManager>


It looks like BasicDatePicker costs money, so I can't easily try for myself. Could you please capture a good and a bad trace with Fiddler so we can have a look at what might be going on? Also, running under Firefox+Firebug could show errors that might be happening. Thanks!


Hi David,

We're using BasicDatePicker Lite which is free, so you should be able to try that one?

Unfortunately I can't install Fiddler at work because of network restrictions! Great eh! I did use the Firefox+Firebug combination though and it came back with no errors...


Chris,

Just downloaded BasicDatePicker Lite (1.3.5.0) and tried it in the following sample page. It works fine for me with ToolkitScriptManager. Maybe you could indicate what changes need to be made to this page to demonstrate the problem?

<%@. Page Language="C#" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><%@. Register Assembly="BasicFrame.WebControls.BasicDatePicker" Namespace="BasicFrame.WebControls" TagPrefix="bdp" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>BasicDatePicker Lite Test</title></head><body> <form id="form1" runat="server"> <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" /> <bdp:BDPLite ID="BDPL1" runat="server" /> </form></body></html>

David,

Apologies for my lack of information previously. Go Live week here (and also my last week at this company, so doing hand over stuff as well... Frantic does not sum it up!Smile)

Below is an example of it NOT working... If you simply change the ajaxToolkit:ToolkitScriptManager back to an asp:ScriptManager then hey presto, it works again...

<%@.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>
<%@.RegisterTagPrefix="BDP"Namespace="BasicFrame.WebControls"Assembly="BasicFrame.WebControls.BasicDatePicker" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
</head>
<body>
<formid="form1"runat="server">
<ajaxToolkit:ToolkitScriptManagerID="scriptmanager1"runat="server"></ajaxToolkit:ToolkitScriptManager>
<div>
<asp:UpdatePanelID="updDate"runat="server">
<ContentTemplate>
<asp:LinkButtonID="linkShow"runat="server"Text="Show Date Picker"></asp:LinkButton>
<asp:MultiViewID="mvDate"runat="server"ActiveViewIndex="-1">
<asp:ViewID="viewDate"runat="server">
<BDP:BDPLiteID="bdplite"runat="server"DateFormat="d"/>
</asp:View>
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>


Thanks much for putting this together! I now see the problem behavior, too. I investigated a bit, and I don't think it's the fault of ToolkitScriptManager (ever since you said this happened with CombineScripts=false, I've wondered...). Here's how to create a repro scenario that doesn't involve the Toolkit at all: File | New Web Site, New ASP.NET AJAX Web Site, create a BIN directory and add the BDPLite assembly to it, create an App_Code directory and add MyScriptManager.cs (below), replace the contents of Default.aspx (below), Run. You'll notice the same problematic behavior - and clearly MyScriptManager behaves identically to ScriptManager! I suspect that the BDPLite component is somehow requiring the specific ScriptManager class that ships with ASP.NET AJAX and consequently rejecting any subclasses (like MyScriptManager and ToolkitScriptManager). If so, this is an issue someone will need to take up with the BDPLite folks as they're the ones who need to fix it. (If you'd like me to contact them instead, just drop me a note.)

Thanks for the help tracking this down!

MyScriptManager.cs:

using System;using System.Web.UI;namespace MyControls{// The simplest ScriptManager subclass possiblepublic class MyScriptManager : ScriptManager { }}

Default.aspx:

<%@. Page Language="C#" AutoEventWireup="true" %><%@. Register TagPrefix="BDP" Namespace="BasicFrame.WebControls" Assembly="BasicFrame.WebControls.BasicDatePicker" %><%@. Register Namespace="MyControls" TagPrefix="MSM" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server"> protected void linkShow_Click(object sender, EventArgs e) { mvDate.ActiveViewIndex = 0; }</script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"><%--<asp:ScriptManager ID="scriptmanager1" runat="server" />--%> <MSM:MyScriptManager ID="scriptmanager1" runat="server" /> <div> <asp:UpdatePanel ID="updDate" runat="server"> <ContentTemplate> <asp:LinkButton ID="linkShow" runat="server" Text="Show Date Picker" OnClick="linkShow_Click"></asp:LinkButton> <asp:MultiView ID="mvDate" runat="server" ActiveViewIndex="-1"> <asp:View ID="viewDate" runat="server"> <BDP:BDPLite ID="bdplite" runat="server" DateFormat="d" /> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>

Good work tracking that down David! And, erm, glad you worked out what the code in the code behind wasEmbarrassed

I've posted a message on the BDP forum (http://forums.basicdatepicker.com/forums/1250/ShowThread.aspx#1250) but by all means feel free to drop them an email if you like. I may well drop them an email too if theres no feedback via their support forum.

Thanks again David.


Hi ctafield,

We're doing a specific check to see if the System.Web.UI.ScriptManager object is present on the page in order to determine how/where the JavaScript should be rendered/registered. Unfortunately we're not checking for the ToolkitScriptManager object, so that will have to be added to the source. The changes should be quick, although we need a day or two to run some tests.

I will update this post when a new build is available. Thanks for pointing out the problem.


Geoffrey,

I can't tell what you plan from your reply, but if it's possible for you to support *any* subclass of ScriptManager (vs. just adding a specific check for ToolkitScriptManager), I think your users will be even happier. :)

And thanks for the quick response to this issue!

No comments:

Post a Comment