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

Object doesn't support property or method 'getToolByName'

2 Answers 119 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Felipe
Top achievements
Rank 1
Felipe asked on 01 Sep 2011, 03:45 PM
Hi, 

         I have an editor(telerik:RadEditor) inside a List(telerik:RadListView), when the user clicks edit it will display the editor. I want to disable some buttons the user should not see, I tried using this code:
<script>
 function OnClientLoad(editor) {
             var oTool = editor.getToolByName("SpellCheck");
              var icon = oTool.GetIcon();
                icon.style.display = "none";
 
</script>
<telerik:RadEditor OnClientLoad="OnClientLoad" ....

But when I click edit I get this error: Object doesn't support property or method 'getToolByName' 

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 02 Sep 2011, 04:30 PM
Hello Felipe,

For your convenience I have recorded a video demonstrating how to achieve your scenario: http://screencast.com/t/MN0VmKqQ.
For a base I used the following demo: Edit and insert templates.

Note that there is not such a method GetIcon, here is the correct syntax to hide the button:

Copy Code
<script type="text/javascript">
    function OnClientLoad(editor) {
        var oTool = editor.getToolByName("AjaxSpellCheck");
        var icon = oTool.get_element();
        icon.style.display = "none";
    }
</script>



All the best,
Rumen
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Felipe
Top achievements
Rank 1
answered on 02 Sep 2011, 04:40 PM

Here is the error in my code. The function "onClientLoad(editor)" had to be declared after the control RadEditor. I was declaring it above that generates the error in my code.


Thanks for you help.


Tags
Editor
Asked by
Felipe
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Felipe
Top achievements
Rank 1
Share this question
or