Typps Editor and UpdatePanel errors

Feb 20, 2011 at 4:17 PM

I'm having a problem when I add the Typps Editor inside an AJAX UpdatePanel.  I even tried creating a brand new ASP.NET 4 web site, added one web page, then added a button, a label, and an UpdatePanel to it.  That works as expected, when you postback with the button the label text gets updated.  Simple test on a clean project.  Now when I add the Typps Editor to the UpdatePanel (make the necessary Web.config updates) and re-browse the page, I get 7 errors come up in IE saying the same thing.  "Expected ';'" with some huge line number like "Line: 184081329" in Default.aspx.  There's also an 8th error about a duplicate component with the same ID that reads:

Line: 4773Error: Sys.InvalidOperationException: Two components with the same id 'TyppsEditor_updatepanelprogress' can't be added to the application.

Am I missing some tweak somewhere?  I've tried it in both Visual Studio 2008 and 2010 using both .NET Framework 3.5 & 4 and I keep getting the same problem when posting back an UpdatePanel that the editor is in.

Any help would be appreciated.
Thanks! 

Coordinator
Feb 20, 2011 at 7:19 PM

Hello, try to paste the code you are using and the exact setup so that we can reproduce the problem you are seeing.

Thanks for reporting,

Alessandro

Feb 21, 2011 at 1:40 PM

Hi Alessandro,

Thanks for replying.  I'm using Visual Studio 2010 creating a web site using .NET Framework 4 on a Windows 7 Professional 64-bit system using IIS 7.5.  This sample has nothing special added, just an empty web site where I added one page with the ScriptManager, a button, a label, and the Typps Editor. Please let me know if you have any thoughts.

Thanks!
Joe

The code in my page looks like this:

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" ValidateRequest="false" %>

<%@ Register Assembly="Typps" Namespace="Typps" TagPrefix="cc1" %>

<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server"></asp:ScriptManager>
    <div>
        <asp:UpdatePanel runat="server">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                <br />
                <asp:Button ID="Button1" runat="server" Text="Button" />
                <br />
                <cc1:Editor runat="server"></cc1:Editor>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

 

The code-behind looks like this:

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = Date.Now.ToLongTimeString
    End Sub
End Class

The code in the Web.Config looks like this:

 

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="false" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
    <httpHandlers>
      <add verb="*" path="typps.axd" type="Typps.WebResourceHandler" />
    </httpHandlers>
    <httpRuntime requestValidationMode="2.0"/>
  </system.web>
  <system.webServer>
    <handlers>
      <add verb="*" path="typps.axd" type="Typps.WebResourceHandler" name="WebResourceHandler" preCondition="integratedMode" />
    </handlers>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>
</configuration>

 

 

Coordinator
Feb 21, 2011 at 4:40 PM

Hello, thank you for the detailed instructions. I was able to reproduce this issue. It happens when the editor is nested inside an updatepanel as you are doing. I have traced this problem to a special code path the ASP.NET ajax extentions library takes when the script manager is in debug mode.

Since there is nothing I can do on my side, I can only suggest that you run the scriptManager in release mode. When the script manager is in release mode, all is good. FYI, the script manager runs in debug mode by default when you run your project in visual studio in Debug mode or when you set the ScriptMode to debug explicitly. 

To fix the problem you are seeing, set your scriptmanager explicitly to release mode like below : 

<asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" runat="server"></asp:ScriptManager>

Sadly, this is an inherent issue in the ASP.NET AJAX extentions library and if you nest the editor in an updatepanel as you are doing, then this is necessary.

Best regards,

Alessandro

Feb 21, 2011 at 9:08 PM

Hi Alessandro,

I appreciate you taking the time to look into this.  I tried formatting the ScriptManager tag as you suggested and still received the same error messages (built, re-built, created another new project, etc...).  In another project I have the latest version of the ASP.NET Ajax Control Toolkit added to it and I tried adding the ScriptMode attribute to the ToolkitScriptManager element and that didn't work for it either.

I'll try to look into this a little more to see why it still doesn't work in my projects and let you know if I find something.

Again, I really do appreciate the time you took looking into this and narrowing it down to the ASP.NET ajax extensions library.

Regards,
Joe