Object doesn't support property or method 'getToolByName'

3 posts, 1 answers
  1. Felipe
    Felipe avatar
    3 posts
    Member since:
    Aug 2010

    Posted 01 Sep 2011 Link to this post

    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. Answer
    Rumen
    Admin
    Rumen avatar
    13755 posts

    Posted 02 Sep 2011 Link to this post

    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 >>

  3. Felipe
    Felipe avatar
    3 posts
    Member since:
    Aug 2010

    Posted 02 Sep 2011 Link to this post

    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.


Back to Top