$find('RadEditor1').set_html("hello") doesn't work.

2 posts, 0 answers
  1. Daniel Qin
    Daniel Qin avatar
    8 posts
    Member since:
    Oct 2009

    Posted 07 Oct 2010 Link to this post


    i am using RadEditor(it's DNNRichTextEditor really) inside RadWindow. 
    such like :
    <telerik:RadWindow ID="WinAddNew" runat="server">
             <cc1:DNNRichTextEditControl ID="txtContent" runat="server" Width="500" Height="300" />

    var editor;

            function pageLoad()  
                editor = $find("<%=txtContent.ClientID%>"); //get a reference to RadEditor client-side object   
    editor is null. 
    even i am using $get. 
    could you give me some advices?

    Thank you.

  2. Rumen
    Rumen avatar
    14419 posts

    Posted 08 Oct 2010 Link to this post

    Hello Daniel,

    You can try the following code to get a reference to RadEditor

    <script type="text/javascript">
        function pageLoad() {
            if (typeof ($telerik) != "undefined") {
                if ($telerik.radControls && Telerik.Web.UI.RadEditor) {
                    for (var i = 0; i < $telerik.radControls.length; i++) {
                        var control = $telerik.radControls[i];
                        if (Telerik.Web.UI.RadEditor.isInstanceOfType(control)) {
                            //control is a radeditor object

    The code should be run after our controls have been initialized (after the Sys.Application.Init event). The code I have pasted includes some extra checks to make sure it does not fail if there is no RadEditor on the page. To check the type of the control I use the isInstanceOfType method. See this article for more information: How-to create a javascript array of all particular RadControls on the page.

    Another approach is to attach the OnClientLoad event to get a reference to RadEditor. See this KB article for more information: Executing custom code called on RadEditor's events.

    Best regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top