Opened 8 years ago

Closed 8 years ago

#6343 closed Bug (expired)

FCK not working very well with asp.net and ajax

Reported by: Cade Owned by:
Priority: Normal Milestone:
Component: Server : ASP.Net Version: FCKeditor 2.6.5
Keywords: Cc:

Description (last modified by Krzysztof Studnik)

After entering in something with html formatting into the FCK editor, the next partial postback will give an error. The one after that will be fine and it will alternate back and forth like that until the page is refreshed. Full postbacks don’t error like the partial postbacks do.

STEPS TO REPRODUCE:

  1. Create a new aspx project in Visual Studio 2008.
  2. Include the fckeditor folder
  3. Include the ajax toolkit binary and the FCK asp wrapper binary file in the bin folder of the project.
  4. Add a page named testFCK to the site with the following code:

testFCK.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testFCK.aspx.cs" Inherits="testFCK" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </ajaxToolkit:ToolkitScriptManager>
    <div>
        <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="up">
            <Triggers>
                <asp:PostBackTrigger ControlID="btnFull" />
            </Triggers>
            <ContentTemplate>
                <FCKeditorV2:FCKeditor runat="server" ID="Body" BasePath="fckeditor/" ToolbarSet="Default"
                    Height="400px" HtmlEncodeOutput="true" EnableViewState='false'>
                </FCKeditorV2:FCKeditor>
                <asp:Button runat="server" OnClick="posted" Text="Partial" />
                <asp:Button ID="btnFull" runat="server" OnClick="posted" Text="Full" />
                <asp:Label runat="server" ID="lblTest"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

testFCK.aspx.cs

using System;
using System.Web;

public partial class testFCK : System.Web.UI.Page
{
    protected override void OnError(EventArgs e)
    {
        HttpContext ctx = HttpContext.Current;
        Exception exception = ctx.Server.GetLastError();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            Body.Value = "hello<br />World!";
        }
    }

    protected void posted(object sender, EventArgs e)
    {
        lblTest.Text += "Posted back successfully!";
        Body.Value += "<br>Again!";
        up.Update();
    }
}
  1. Open the site up in the debugger.
  2. Click the button labeled "partial". Note that the first click does nothing (because it causes an error before the Page_Load method). Also note that the button works the 2nd/4th/6th etc... time.
  3. Click the button labeled "full". Note that it works every time.

The testing environment I'm running this on is Visual Studio 2008, Microsoft Windows XP SP3. Tested on Firefox 3.6.10, but I'm pretty sure I've seen it happen in current versions of IE and Chrome as well.

The workaround that I'm currently using for this is to do a full postback whenever I want to submit the FCKEditor content and then cause a complete refresh in the codebehind. But that workaround is not ideal.

Attachments (2)

testFCK.aspx (1.5 KB) - added by Cade 8 years ago.
testFCK.aspx.cs (734 bytes) - added by Cade 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Cade

Attachment: testFCK.aspx added

Changed 8 years ago by Cade

Attachment: testFCK.aspx.cs added

comment:1 Changed 8 years ago by Cade

I forgot to mention that the specific error that it throws is a "A potentially dangerous Request.Form value was detected from the client..."

comment:2 Changed 8 years ago by Krzysztof Studnik

Description: modified (diff)
Keywords: asp.net ajax async postback removed

comment:3 Changed 8 years ago by sandhya pingle

Hi,

I am facing the same issue? is there any fix for this.

Sandhya.

comment:4 Changed 8 years ago by Wiktor Walc

Resolution: expired
Status: newclosed

There is a new ASP.NET control available: CKEditor for ASP.NET. The old control (FCKeditor.Net) is no longer maintained, so I'm closing the ticket. In the new CKEditor control we have solved many issues with ASP.NET AJAX.

However, if you still find a similar bug in CKEditor 3.x, please create a new ticket for it.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy