Editor .Text property doesn't change after being set in Page_Load

Last post 10-01-2010, 2:51 PM by Adam. 1 replies.
Sort Posts: Previous Next
  •  10-01-2010, 2:55 AM 64286

    Editor .Text property doesn't change after being set in Page_Load

    I am attempting to load some HTML into cuteeditor on Page_Load, by setting Editor1.Text = <HTML>
    What I'm finding is that when the save button is clicked, regardless of what the editor content has been changed to, Editor1.Text is the same as what it was set to in Page_Load.
    In the PostBackCommand event, ((<Appropriate cast>)sender).Text is the same; and in both cases .XHTML is having the same problem.
     
    If I don't set Editor1.Text in Page_Load, this problem doesn't occur and changes made with the editor are apparent in Editor1.Text.
     
    Can anyone tell me what is going wrong, and what is the correct way to load the editor with some specified content?
    Filed under:
  •  10-01-2010, 2:51 PM 64301 in reply to 64286

    Re: Editor .Text property doesn't change after being set in Page_Load

    Can you try the following code?
     

    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
      <title></title>
     </head>
     <body>
            <form runat="server">
       <CE:Editor id="Editor1" runat="server" ></CE:Editor><br />
       <asp:Literal ID="Literal1" Runat="server" />        
      </form>
     </body>
    </html>

    <script runat="server">
     void Page_Load(object sender, System.EventArgs e)
      {
         if (IsPostBack)
      {
       Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
       Literal1.Text += Server.HtmlEncode(Editor1.Text);
         }
      else
      {
          Editor1.Text = "Type Here";
      }  
     }
    </script>

     Keep me posted


    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