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

Rad Editor EditModes Property

3 Answers 113 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 10 Dec 2009, 02:02 PM
Hi,

I am using Q2 2009 version. I am displaying one pop up.  In that pop up, there is a Save  button  When i click on the save button,  i am  inserting content  in to the editor through JavaScript.

Editor is in the parent window.

Here is the code which i have written in the Pop up window.

 var editor=window.opener.document.getElementById("ctl00_ContentPlaceHolder1_RadTxtCheifComplaint");   // Editor id     
 editor.innerHTML=  someText;                //  Inserting text from pop up window.; 
 window.close();   




When the popup close.Text insert in to the Editor and Editor display in the Preview mode instead of design mode. i want t dispaly in the design mode. How to set Design mode of editor from javascript.


Please give me the solutions ASAP.


Regards

Rahul

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 14 Dec 2009, 02:49 PM
Hi Rahul,

You should get a proper reference to RadEditor. Since the editor is in the parent page, I suggest to put a JavaScript function there that gets the proper reference and set the content:
function SetContent(content)
{
   var editor = $find("<%= RadEditor1.ClientID %>"); //get a reference to RadEditor client object
   editor.set_html(content); //set the content
}

Then from the content page, you can fire that JavaScript function and pass the content as parameter:
window.opener.SetContent(content);



Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Trevor
Top achievements
Rank 1
answered on 30 Mar 2011, 08:33 PM
I would like to add a toolbutton to the toolbar of the editor to toggle from preview to html view and remove the tabs at the bottom.
How can I do this?
also, how can i change the editmodes in javascript from preview to html.

Cheers,

Trevor
0
Marin Bratanov
Telerik team
answered on 31 Mar 2011, 04:17 PM
Hi Trevor,

How to add custom buttons is explained in the following article:
http://www.telerik.com/help/aspnet-ajax/editor-adding-your-own-buttons.html.
How to remove the modules is explained in the following article:
http://www.telerik.com/help/aspnet-ajax/editor_disablehidemodules.html.
How to switch between modes via JavaScript is explained in the following article:
http://www.telerik.com/help/aspnet-ajax/editor-set-mode.html.

For your convenience I have attached a page that displays the required functionality.

Please note:
  • the use of EnsureToolsFileLoaded() method that prevents the new buttons from replacing the initial toolbars.
  • the CSS classes that hide the modules' wrappers after I have disabled the modules themselves
  • the necessary JavaScript that enables the custom buttons in HTML and Preview mode


Regards,
Marin
the Telerik team
Tags
Editor
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Trevor
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or