CuteEditor 2.0 and control events

Last post 12-15-2003, 2:19 AM by ChrisBissell. 5 replies.
Sort Posts: Previous Next
  •  11-18-2003, 6:29 PM 79

    CuteEditor 2.0 and control events

    Hello!

    I have a question here.  I am trying to implement a user control that uses the CuteEditor 2.0 to save information to the database (you know, pretty typical stuff).  To do this, I am:

    1. Populating the Editor from the dataset in the Page's Load event.
    2. Capturing a "Save" button click on the server.
    3. Updating the database.
    4. Loading the changed data back into the Editor (in the OnPreRender event of the Page). 

    The problem is the last step.  For some reason when I load the data into the Editor the second time it doesn't appear.  The Editor is rendered as completely empty!  When I look at the generated HTML source, I see that there is a Hidden field with the correct HTML I wanted to appear, but it isn't showing in the Editor itself.  I've tried a variety of approaches (this exact same code, BTW, worked fine in 1.8 of the editor) but don't seem to have any luck.  Also, I'm using the same code to populate the Editor pre-update as I am post-update.

    I'll keep trying to find a solution and let you know if I do. 

    Chris

     

  •  11-18-2003, 6:51 PM 80 in reply to 79

    Re: CuteEditor 2.0 and control events

    On further investigation, I see what the problem appears to be:

    In the generated HTML there's a DIV called "[EDITOR NAME]_EditBox" that contains the HTML that I directly edit.

    There is also, however, a hidden INPUT field that contains the same code.

    When I update my changes to the database and set the Text property of my Editor to the new value, it seems to change the INPUT field but not the EditBox.

  •  11-19-2003, 12:17 PM 84 in reply to 80

    Re: CuteEditor 2.0 and control events

    I'm thinking that to resolve this issue I could capture the OnLoad event of the document (on the client, in JavaScript) and manually sync the contents of the Hidden field with the InnerHTML property of the EditBox DIV.  Does that make sense?

    Chris

     

  •  11-19-2003, 8:29 PM 91 in reply to 84

    Re: CuteEditor 2.0 and control events

    Chris,

    Sorry for the late response.

    Surprised to listen that, actually I've been investigating this issue since you post this message.

    We use the same method in our datagrid example:

  • Populating the Editor from the dataset in the Page's Load event.
  • Capturing a "Save" button click on the server.
  • Updating the database.
  • Loading the changed data back into the Editor (in the OnPreRender event of the Page). 
  • http://cutesoft.net/Example/DataGrid_vb.aspx

    It works.

    I'm thinking that to resolve this issue I could capture the OnLoad event of the document (on the client, in JavaScript) and manually sync the contents of the Hidden field with the InnerHTML property of the EditBox DIV.  Does that make sense?

    I don't suggest you do that. That's the CuteEditor supposed to do.

    If you still can't figure it out, can u send me the complete code you are using (only file where it is producing the problem will be enough).

    I will check that and will let u know.

     


     


    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-09-2003, 1:26 PM 119 in reply to 80

    Re: CuteEditor 2.0 and control events

    Funny. I have the same problem with my web form which has a calendar control. When I select a date in the calendar control (which causes a post-back), the CE window goes blank but the value is in a hidden field....

    Strange. Still trying to figure out a work around.

  •  12-15-2003, 2:19 AM 126 in reply to 119

    Re: CuteEditor 2.0 and control events

    Yes, that's the problem I had, for sure.  I stuck in the following JavaScript code and it's been working fine.  My theory is that the fact that I'm dynamically loading all of this inside of a User Control is causing CuteEditor's JavaScript to miss the client ID of the Editor.  Make sure this JavaScript comes after the Editor's XML.  Or call setText() from document.onload.

    var editorID = [stick in the editor ClientID from the codebehind]<%# this.Editor1.ClientID %><%# this.Editor1.ClientID %>;

    function setText()
    {
    document.getElementById(editorID + "_editBox").innerHTML = document.getElementById(editorID + "_HTMLContent").value;

    }

    setText();

     

View as RSS news feed in XML