Re: How to get if content of editor updated or not

  •  09-26-2011, 7:50 AM

    Re: How to get if content of editor updated or not

    Hi DhirajGupta,
     
    Please try the example below
     
    <%@ Page Language="C#" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <!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 id="Head1" runat="server">
        <title>example</title>
    </head>
    <script runat="server">
        protected override void OnLoad(EventArgs e)
        {
            editor1.Text = "this is a test";
            label1.Text = editor1.Text;
            base.OnLoad(e);
        }
    </script>
    <body>
        <form id="Form1" runat="server">
            <CE:Editor ID="editor1" runat="server">
            </CE:Editor>
            <input type="button" value="check" onclick="check()" /><br />
            click on the button, if you changed the text, it will show a message.
            <asp:Label ID="label1" runat="server" Style="visibility: hidden"></asp:Label>
        </form>
    </body>
    </html>

    <script type="text/javascript">

    var editor1=document.getElementById("<%= editor1.ClientID %>");
    var label1=document.getElementById("<%= label1.ClientID %>");
    function check()
    {

    var str1=label1.innerHTML.toLowerCase();
    var str2=editor1.getHTML().toLowerCase();

    if(!(str1.indexOf(str2)==0 && str2.indexOf(str1)==0))
    {
        alert("text have been changed");
    }
    }
    </script>
     
    Regards,
     
    Ken
View Complete Thread