Client load event not firing with Editor is disable

4 posts, 0 answers
  1. Guillermo Andres
    Guillermo Andres avatar
    4 posts
    Member since:
    Aug 2006

    Posted 23 Nov 2011 Link to this post

    Hi all,

    I have a RadEditor that changes between edit and view mode. When disabling the Editor, the toolbar disappear and it looks cleaner for view mode but the OnClientLoad and OnClientInit event are not triggering. As soon as I enable the editor, it works.  

    Any work around?
  2. Rumen
    Admin
    Rumen avatar
    14431 posts

    Posted 24 Nov 2011 Link to this post

    Hi Grillonegro,

    When the Enabled property of RadEditor is set to false, then the editor is rendered as a standard DIV element on the page and its content is loaded in this DIV. Since there is no editor on the page its client event are not loaded. This is by design.

    If you would like to disable the editor without rendering a DIV on the page, you should do that on the client using the editor.enableEditing(false) method. Here is an example:

    <telerik:RadEditor runat="server" ID="RadEditor1">
    <Content>some test content</Content>
    </telerik:RadEditor>
    <input type="button" onclick="toggleEditing();return false;" value="Toggle editing" />
    <script type="text/javascript">
    var toggle = true;
    function toggleEditing()
    {
    var editor = $find("<%=RadEditor1.ClientID%>");
    toggle = !toggle;
    editor.enableEditing(toggle);
    editor.set_editable(toggle);
    if (toggle == false) editor.get_document().body.style.backgroundColor = "gray";
    else editor.get_document().body.style.backgroundColor = "";
    }
    </script>

    Best regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. Guillermo Andres
    Guillermo Andres avatar
    4 posts
    Member since:
    Aug 2006

    Posted 02 Dec 2011 Link to this post

    Is there a way to disable the Toolbar on client side ?

    Thanks
  4. Guillermo Andres
    Guillermo Andres avatar
    4 posts
    Member since:
    Aug 2006

    Posted 02 Dec 2011 Link to this post

    If I set the property ToolbarMode=ShowOnFocus when RadEditor is on Preview mode, the toolbar wont be displayed.  This is the functionality I was looking for. 

    Many thanks. 
Back to Top