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

How do I access RadEditor added via CreateChildControls

1 Answer 32 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Loke Kit Kai
Top achievements
Rank 1
Loke Kit Kai asked on 17 Oct 2008, 06:19 AM
I've added RadEditor via CreateChildControls in a web part. I'm trying to access the RadEditor to insert some text via javascript, but not having much success. I tried getting the RadEditor with GetRadEditor, but that method doesn't seem to exist. Same goes to get_html(). Is there any js files that I need to add?

1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 17 Oct 2008, 09:51 AM
Hello,

You can access the editor using its client ID. See the following help article for more information: http://www.telerik.com/help/aspnet-ajax/editor_getingreferencetoradeditor.html

If you do not have a reference to the editor control and you cannot get its ClientID property, then you can use a purely client-side approach to finding all instances of the RadEditor on a page using the global $telerik.radControls array:

<script type="text/javascript">  
function findAllEditors() 
  if ($telerik && Telerik.Web.UI.RadEditor) 
  { 
    var len = $telerik.radControls.length; 
    for (var i=0;i<len;i++) 
    { 
      var control = $telerik.radControls[i]; 
      if (Telerik.Web.UI.RadEditor.isInstanceOfType(control)) 
      { 
        var editorHtml = control.get_html(true); 
      } 
    } 
  } 
</script>  

Running the above function after the page is loaded will allow you to get the html of all editors on the page.


Sincerely yours,
Lini
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Loke Kit Kai
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or