Re: Error occured when editor visibility set to false during first load

  •  11-04-2008, 5:55 AM

    Re: Error occured when editor visibility set to false during first load

    Hi Kenneth,
     
    Here are my codes where the CuteEditor_FilterHTML function is not working when the panel which contained Editor was turn on. The panel is invisible when the form was first loaded. There is a button to turn on the panel for Editor. Thanks.
     
    Code in Default.aspx

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

    <%@ Register Assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

    Namespace="Microsoft.Web.UI" TagPrefix="asp" %>

    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>

    <!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>Untitled Page</title>

    </head>

    <body>

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

    <asp:ScriptManager ID="ScriptManager1" runat="server">

    </asp:ScriptManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">

    <ContentTemplate>

    <asp:Panel ID="panel1" runat="server" Visible="false">

    <CE:Editor ID="editor1" runat="server">

    </CE:Editor>

    </asp:Panel>

    </ContentTemplate>

    </asp:UpdatePanel>

    <asp:Button ID="BtnChangeVisibility" runat="server" Text="Change Visibility" OnClick="BtnChangeVisibility_OnClick" />

    </form>

    </body>

    </html>

    <script>

    function CuteEditor_FilterHTML(editor,code)

    {

    return code.replace(/(<form[^\>]*\>)([\s\S]*)(\<\/form\>)/i, "$2");

    }

    function CuteEditor_FilterCode(editor,code)

    {

    return code.replace(/(<form[^\>]*\>)([\s\S]*)(\<\/form\>)/i, "$2");

    }

    </script>

     
    Code in Default.aspx.cs
     

    using System;

    using System.Data;

    using System.Configuration;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Web.UI.HtmlControls;

    public partial class _Default : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    }

    protected void BtnChangeVisibility_OnClick(object sender, EventArgs e)

    {

    panel1.Visible = !panel1.Visible;

    }

    }

     
View Complete Thread