New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Enabling Print button in Preview mode

HOW-TO

Enable Print button in Preview mode

SOLUTION

The code below demonstrates how to enable the Print button in Preview mode of RadEditor. It checks whether the current mode of RadEditor is Preview using the get_mode() method, after that it gets a reference to the "Print" tool using the getToolByName() method and enables it using the setState(0) method, e.g.

<telerik:radeditor runat="server" OnClientModeChange="OnClientModeChange" ID="RadEditor1"></telerik:radeditor>
<script type="text/javascript">
   function OnClientModeChange(editor, args)
   {
       var mode = editor.get_mode();                     
       switch (mode)
       {
           case 1:
               //alert( "We are in Design mode");
               //do something
           break;
           case 2:
               //alert("We are in HTML mode");
           break;
           case 4:
               setTimeout(function()
               {
                   var tool = editor.getToolByName("Print");
                   tool.setState(0);
               }, 0);
               //alert( "We are in Preview mode");
               //do something
           break;
       }
   }
 </script>
In this article