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

RadEditor Issue with ToolbarMode="ShowOnFocus"

3 Answers 74 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vivek
Top achievements
Rank 1
Vivek asked on 31 Oct 2012, 11:41 AM
I am facing the Telerik RadEditor Issue With ToolbarMode="ShowOnFocus" working with ASP.NET
<telerik:RadEditor ID="RadEditor1" runat="server"  OnClientLoad="OnClientLoad"  EditModes="Design" Width="300px" Height="300px"     Skin="Outlook" ToolbarMode="ShowOnFocus" ToolsFile="~/xml/Tools.xml">                                                   
</telerik:RadEditor>

and add a link button Click me.
<a href="javascript://" onclick="javascript:return Clickme();">Click Me</a>

now on page load i want to load the the tool bar by default, it is happening by doing
    function OnClientLoad(editor, args) {
           editor.setFocus();
          editor.set_html("");
        }

but on anchor click i want to write something on radeditor and the toolbar is not visible. i tried to setFocus and set_html("") both.
function Clickme() {
            var editor = $find("RadEditor1");
           editor.setFocus();
            editor.set_html("");
}

have anyone idea about this issue?

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 02 Nov 2012, 03:33 PM
Hello,

You can try the following code:

<br /><br /><br /><br /><br /><br /><br /><br />
<telerik:RadEditor ID="RadEditor1" runat="server"  Width="300px" Height="300px" 
   ToolbarMode="ShowOnFocus">                                                  
</telerik:RadEditor>
 
<a href="#"  onclick="Clickme();return false;">Click Me</a>
<input type="button" onclick="Clickme()" value="Click Me"/>
    <script type="text/javascript">
        function Clickme() {
            var editor = $find("RadEditor1");
            if ($telerik.isIE) {
                setTimeout(function () {
                    editor.setFocus();
                    editor.fire("Enter");
                    editor.set_html("");
                }, 0);
            }
            else {
                setTimeout(function() {
                    editor.setFocus();
                    editor.set_html("");
                }, 10)
            }
        }
    </script>


All the best,
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.
0
Vivek
Top achievements
Rank 1
answered on 07 Nov 2012, 08:04 AM
Hi Rumen
I tried your solution, but it is not working. one more issue i found that in IE(version- 9) browser the toolbar not showing in onload. while i implemeted the function. while in mozila and chrome it's fine.
  function OnClientLoad(editor, args) {
           editor.setFocus();
          editor.set_html("");
        }

I implemented your suggested code on 
function OnClientLoad(editor, args) {
if ($telerik.isIE) {
                setTimeout(function () {
                    editor.setFocus();
                    editor.fire("Enter");
                    editor.set_html("");
                }, 0);
            }
            else {
                setTimeout(function() {
                    editor.setFocus();
                    editor.set_html("");
                }, 10)
            }
}

Thanks
Vivek
0
Dobromir
Telerik team
answered on 08 Nov 2012, 12:01 PM
Hello,

I am not quite sure why the suggested solution is not working for you. I tried it locally and it working as expected. For your convenience I have attached my test page, could you please modify it to a point where the problem occurs and send it back?

Also, could you please verify that there are not JavaScript errors thrown during PageLoad?

Regards,
Dobromir
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.
Tags
Editor
Asked by
Vivek
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Vivek
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or