Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Client Command API

Restart Demonstration
  • Undopo
    Undo
  • Cut
    Clipboardpo
    Clipboard
  • v
    v
    po
    po
    po
    Fontpo
    dialogboxlauncherFont
  • po
    po
    Paragraphpo
    dialogboxlauncherParagraph
  • Stylespo
    Styles
  • Editing
  • Table Style Optionspo
    Table Style Options
  • Table Stylespo
    Table Styles
  • v
    v
    Borders & Shadingspo
    dialogboxlauncherBorders & Shadings
  • Navigation
  • Options
  • Header from Top:
    +
    -
    Footer from Bottom:
    +
    -
    Positionpo
    Position
  • Close
  • v
    Shape Stylespo
    Shape Styles
  • dialogboxlauncherArrange


The ASP.NET MVC Rich Text Editor (RichEdit) provides a comprehensive API, allowing you to manipulate the open document programmatically on the client side. The available client manipulation API is exposed through the following properties.

  • document
    Provides access to structures that allow you to obtain the current information about certain document structural elements (such as sections, active sub-document, styles for characters, paragraphs and tables, and etc.).
  • selection
    Provides access to a set of methods that allow you to position the cursor within a document and to select document content elements.
  • commands
    Provides access to client commands that allow you to programmatically accomplish virtually any task within a document (such as inserting characters, paragraphs, tables and pictures, changing element formatting, creating numbered lists, etc.).

Available commands are a powerful tool for manipulating document content on the client using code. Most commands replicate the RichEdit's default UI commands available through the editor's ribbon. These commands are useful when you are required to implement a custom toolbar for the RichEdit instead of the default built-in ribbon. For an example of such a custom toolbar, refer to the Custom Toolbar via Client API demo.

Each command exposes the execute and getState methods. For its execution, a command may require additional data to be passed as the execute method's parameter. The execute method may result in no action taken if a command's state obtained using the getState method does not allow command execution (for instance, in case when a command is not enabled in the ribbon).

This demo is an illustration of how the client API for commands and selection can be used in the RichEdit.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxRichEditDemos