All Controls


Rate this demo

Thank you for your post!
Submit a support ticket
If you have an active license or trial, you have access to dedicated support from Telerik’s developers. Response time is 24h for active licenses and 72h for trials, Mon-Fri.
Post in the forums
If you don’t have access to support or would like to help other people by sharing your problem, reach out to our active community in the forums.

Editor - Client-side API

RadEditor - HTML WYSIWYG Editor. MS Word-like content editing experience thanks to a rich set of formatting tools, dropdowns, dialogs, system modules and built-in spell-check.
RadEditor's components - toolbar, content area, modes and modules
Toolbar's wrapper  
Content area wrapper
RadEditor's bottom area: Design, Html and Preview modes, Statistics module and resize handle.
It contains RadEditor's Modes/views (HTML, Design and Preview), Statistics and Resizer
Editor Mode buttonsStatistics moduleEditor resizer
RadEditor's Modules - special tools used to provide extra information such as Tag Inspector, Real Time HTML Viewer, Tag Properties and other.

Client-Side API

RadEditor provides a rich Client-Side API and event model. You can attach custom client-script code (JavaScript) to a number of client-side events fired by the editor. All client-side events are exposed as string properties to the RadEditor instance with the value being the name of the JavaScript function to be called. 
Below is a list of all client-side events and methods that are currently supported by RadEditor:


  1. OnClientInit - fired before RadEditor initialization
  2. OnClientLoad  - fired after the RadEditor is loaded on the client
  3. OnClientCommandExecuting - fired just before a command is executed
  4. OnClientCommandExecuted - fired after a command is executed 
  5. OnClientSelectionChange - fired when the selection within the editor content area has changed
  6. OnClientModeChange - fired when the editor's mode is changed
  7. OnClientSubmit - fired when the editor saves its content just before a postback/ajax request 


  1. pasteHtml - Pastes HTML content to the cursor position.
  2. set_html - Replaces the current content with a new one.
  3. setFocus - Sets the focus on RadEditor.
  4. get_html - Returns the editor content as HTML.
  5. get_text - Returns the editor content as plain text.
  6. getSelection - Returns a reference to the current RadEditorSelection object.
  7. getSelectionHtml - Returns the HTML of the selection.
  8. fire - Executes RadEditor commands.
  9. getToolByName - Returns tool so for the purposes of client-side manipulation.
  10. get_contentArea - Returns a reference to the editor's content area.
  11. showExternalDialog - Shows a dialog with the supplied arguments.
  12. attachEventHandler - Attaches an event to its handler.

More information is available in the following help article: Getting familiar with Client-Side API.

Show code in new window Demo isolation steps
<%@ Page Theme="Default" Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs"Inherits="Telerik.Web.Examples.Editor.ClientsideAPI.DefaultCS"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Client-side API in HTML editor for ASP.NET AJAX | RadEditor Demo</title>
     <script type="text/javascript">
         var editor = null;
         function OnClientLoad(sender) {
             editor = sender;

          function ExecuteCommand(command) {
          function AlertSelectedHtml() {
          function SetHtml() {
               var newValue = $get('textHtml').value;
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
     <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Enabled="true" Title="External Buttons"
          Expanded="true" Style="text-align: left; width: 700px;" HorizontalAlign="Right">
          <input type="button" value="SelectAll" onclick="ExecuteCommand('SelectAll')" />
          <input type="button" value="Bold" onclick="ExecuteCommand('Bold')" />
          <input type="button" value="Italic" onclick="ExecuteCommand('Italic')" />
          <input type="button" value="Underline" onclick="ExecuteCommand('Underline')" />
          <input type="button" value="StrikeThrough" onclick="ExecuteCommand('StrikeThrough')" />
          <input type="button" value="ConvertToUpper" onclick="ExecuteCommand('ConvertToUpper')" />
          <input type="button" value="ConvertToLower" onclick="ExecuteCommand('ConvertToLower')" />
     <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
                  <img alt="product logo" src="../../Img/productLogoLight.gif" /> is the successor of the well known industry standard Editor for ASP.NET. The tight integration with ASP.NET AJAX and the powerful new capabilities make Telerik's WYSIWYG Editor a flexible and lightweight component, turning it into the fastest loading Web Editor. Among the hottest features are: 
                         <li><em>Single-file, drag-and-drop deployment</em></li>
                         <li><em>Built on top of ASP.NET AJAX</em></li>
                         <li><em>Unmatched loading speed with new semantic rendering </em></li>
                         <li><em>Full keyboard accessibility</em></li>
                         <li><em>Flexible Skinning mechanism</em></li>
                         <li><em>Simplified and intuitive toolbar configuration</em></li>
                         <li><em>Out-of-the-box XHTML-enabled output</em></li>
     <br />
     <div class="module">
          <input type="button" value="Alert SelectedHtml" onclick="AlertSelectedHtml()" />
     <br />
     <div class="module">
          <input type="button" value="Set New Html to the RadEditor" onclick="SetHtml()" />
          <input type="text" value="New HTML" id="textHtml" />