Opened 12 years ago
Closed 12 years ago
#10730 closed Bug (invalid)
Multiple instances of ckeditor 4.2 in asp.net don't work well with asp:linkbutton controls
Reported by: | joedatesta | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.2 |
Keywords: | asp.net, multiple instances of ckeditor | Cc: |
Description
If you’re using multiple instances of ckeditor and trying to post back with an asp.net linkbutton control. Only one of the instances survives the postback.
This demonstrates the issue. TextBoxSavings changes disappear in the postback.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Travelzoo.Web.Intranet.New.WebForm2" validateRequest="false" %>
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<title></title>
</head>
<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script> <script type="text/javascript" src="/js/ckeditor/adapters/jquery.js"></script>
<body>
<form id="form1" runat="server"> <div>
<asp:Literal ID="litResults" runat="server"></asp:Literal><br /> <asp:TextBox runat="server" ID="TextBoxMarketPricing" CssClass="span7 ckeditor" TextMode="MultiLine" Rows="4"> </asp:TextBox><br /> <asp:TextBox runat="server" ID="TextBoxSavings" CssClass="span7 ckeditor" TextMode="MultiLine" Rows="4"> </asp:TextBox><br /> <asp:LinkButton ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
</div> </form>
</body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace Travelzoo.Web.Intranet.New {
public partial class WebForm2 : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (IsPostBack) {
TextBoxMarketPricing.Text = "<b>Market Pricing</b>"; TextBoxSavings.Text = "<b>Savings</b>";
}
}
protected void btnSave_Click(object sender, EventArgs e) {
litResults.Text = TextBoxMarketPricing.Text + "<br/>" + TextBoxSavings.Text;
}
}
}
This is Visual Studio 2010 running C# on Windows 7 in IE 10.
Please use CKEditor ASP.NET for that and not plain JavaScript CKEditor.
You may use CKE 4.2 client-side with CKE ASP.NET 3.6.4 server side.
http://ckeditor.com/blog/Upgrading-to-CKEditor-4.1
http://ckeditor.com/blog/CKEditor-4.1-RC-Released
http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addTransformations
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraAllowedContent
which you would have to configure or disable from config.js file.