Editor.Text not being updated?

Last post 12-16-2007, 2:05 PM by ralc001. 2 replies.
Sort Posts: Previous Next
  •  12-13-2007, 4:28 PM 35803

    Editor.Text not being updated?

    I have an application where I use the cutesoft editor.
     
    When loading a record from the database, the editor shows text taken from the "Text1" field.
     
    editor1.text = orow.item("Text1")
     
    This shows the text fine.
     
    Now at the bottom of the page, I have a checkbox, chkHTML.  Basically, when this is checked, it sets up the editor to use formatted text instead of plain text.  What this does is it removes the toolbar when the checkbox is unchecked.
     
    Protected Sub chkHTML_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkHTML.CheckedChanged
            If Me.chkHTML.Checked Then
                Me.editor1.ConfigurationPath = "~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/HTML.config"
            Else
                Me.editor1.ConfigurationPath = "~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/PlainText.config"
            End If
    End Sub
     
    Now the problem is this.  If I load the page, the text is loaded fine:  e.g. "Test text loaded".  I then go to the editor and replace the text: e.g. "Replacing default text".  But then when I click the chkHtml checkbox to check it, the toolbar is added fine, but the text in the editor is restored to the first one "Test text loaded".
     
    Stepping through, the text property of the editor is always "Test text loaded" even just after I type in the "Replacing default text", even stepping through a TextChanged event for the editor.
     
    Is there a way to get the newly entered text and keep it?  Thanks
  •  12-14-2007, 9:48 AM 35812 in reply to 35803

    Re: Editor.Text not being updated?

    ralc001,
     
    Did you miss the IsPostBack part?
     
    void Page_Load(object sender, System.EventArgs e)
    {
         if (IsPostBack
         {
             //do something here
         } 
         else 
         {  
             Editor1.Text = "Hello World";
         }  
     }

    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

  •  12-16-2007, 2:05 PM 35832 in reply to 35812

    Re: Editor.Text not being updated?

    Yes I have the IsPostBack part down fine, and when I click on save to save the text of the editor to the database, it does get saved.
     
    The problem is not setting the editor text to "Hello world" or a variable (e.g. strText = "Hello World").  The problem is saving the text property of the editor to the variable (e.g. strText = Editor1.Text).  And only when I try to change the editor.ConfigurationPath property in a checkbox checkchanged event (which does a postback).
     
    I have tried to move the code that changes the configuration path to the page load (to execute if IsPostBack = true) but the problem I described persists.
     

View as RSS news feed in XML