Rad Editor EditModes Property

4 posts, 0 answers
  1. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 10 Dec 2009 Link to this post


    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.; 

    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.


  2. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 14 Dec 2009 Link to this post

    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:

    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.
  3. DevCraft R3 2016 release webinar banner
  4. Trevor
    Trevor avatar
    17 posts
    Member since:
    Mar 2009

    Posted 30 Mar 2011 Link to this post

    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.


  5. Marin Bratanov
    Marin Bratanov avatar
    3561 posts

    Posted 31 Mar 2011 Link to this post

    Hi Trevor,

    How to add custom buttons is explained in the following article:
    How to remove the modules is explained in the following article:
    How to switch between modes via JavaScript is explained in the following article:

    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

    the Telerik team
Back to Top