Problem with editor.text

Last post 08-03-2010, 8:43 AM by Adam. 1 replies.
Sort Posts: Previous Next
  •  08-03-2010, 7:05 AM 63009

    Problem with editor.text

    I'm checking if the text has been modified and if it has i will save it to a database. The method i'm using works with firefox but not IE.
    When using this with IE it puts in extra space at the end of the string.
     
    This is what i have, i use the labels for debugging.
     
            if (!IsPostBack)
            {
                var query ... database action..
     
                    editor1.Text = query.ToString();
                    Session["orgText"] = query.ToString();
            }
     
     
        protected void editor1_PostBackCommand(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                string orgText = (string)Session["orgText"];
                
                if (editor1.Text == orgText)
                {
                    label1.text = "No change!";
                }
                else
                {
                   Databse action.....
                   label1.text = "Text has been saved";
                }
            }

        }
     
     
    Why does it matter if i use IE or Firefox.
    Is there any better why to check this without using Sessions ?
  •  08-03-2010, 8:43 AM 63017 in reply to 63009

    Re: Problem with editor.text

    Please try the following example:
     
    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>  
    2. <%@ Page language="c#"%>  
    3. <html>  
    4.     <head>  
    5. <script runat="server">  
    6.     string OriginalValue="123456";   
    7.     void Page_Load(object sender, System.EventArgs e)   
    8.      {   
    9.         if (IsPostBack)    
    10.         {      
    11.             if (Editor1.Text == OriginalValue)   
    12.             {   
    13.                 label1.Text = "No change!";   
    14.             }   
    15.             else   
    16.             {   
    17.                 label1.Text = "Changed";   
    18.             }   
    19.         }    
    20.         else    
    21.         {      
    22.             Editor1.Text = OriginalValue;   
    23.         }    
    24.        
    25.     }   
    26. </script>  
    27.   
    28.   
    29.     </head>  
    30.     <body>  
    31.         <form id="Form1" method="post" runat="server">  
    32.             <CE:EDITOR id="Editor1" runat="server"></CE:EDITOR><br/>  
    33.             <asp:label Runat="server" id="label1"></asp:label><br/>  
    34.             SSS<%=OriginalValue%>SSS<br/>  
    35.             SSS<%=Editor1.Text%>SSS   
    36.         </form>  
    37.     </body>  
    38. </html>  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML