This is a migrated thread and some comments may be shown as answers.

How can I show text that I type in a RadEditor in another RadEditor

1 Answer 51 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 14 Mar 2013, 02:06 PM

Live, as the user types, I would like the same characters that are entered in one editor to appear in another.  How can I do this?  If there is some way to do this with client-side events, that would be awesome.

What I'm doing is using a RadEditor for a text area where the user types message content for the body of an email.  We have HTML templates for these emails that the user selects.  These get loaded into another RadEditor that shows a Preview of the user's email.   When the user clicks an Update button, the text from the message content editor gets inserted into part of the template inside the preview editor.   This is done so that we can control exactly what parts of the template a user modifies.   

It would be awesome if I could do away with that "Update" button and instead update the Preview as the user types!   

Thanks for your time.

1 Answer, 1 is accepted

Sort by
0
Lee
Top achievements
Rank 1
answered on 14 Mar 2013, 03:03 PM

 
Looks like it is indeed possible.  This works:


function
MessageEditorLoad(editor, args) {
 
 
           editor.attachEventHandler("onkeydown", function (e) {
               setTimeout(function () {
 
                   var messageEditor = $find("<%=EmailMessageEditor.ClientID%>");
                   var previewEditor = $find("<%=EmailPreviewEditor.ClientID%>");
 
                   previewEditor.set_html(messageEditor.get_html(false));
                   messageEditor.setFocus();
 
               }, 0);
           });
       }

Got the idea from:
http://www.telerik.com/community/forums/aspnet-ajax/editor/text-changed-client-side-event-in-radeditor.aspx

Tags
Editor
Asked by
Lee
Top achievements
Rank 1
Answers by
Lee
Top achievements
Rank 1
Share this question
or