Editor - Max Content Length

  • Show/Hide Border
  • Table Properties
  • Delete Table
  • Row
    • Insert Row Above
    • Insert Row Below
    • Delete Row
  • Column
    • Insert Column to the Left
    • Insert Column to the Right
    • Delete Column
  • Cell
    • Merge Cells Horizontally
    • Merge Cells Vertically
    • Split Cell Horizontally
    • Split Cell Vertically
    • Delete Cell
  • Cell Properties
  • Table Properties
  • Properties...
  • Image Map Editor
  • Properties...
  • OpenLink
  • Remove Link
  • Insert Select
  • Cut
  • Copy
  • Paste
  • Paste from Word
  • Paste Plain Text
  • Paste As Html
  • Paste Html
(The text length of the RadEditor control below is restricted to 150 characters.)
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadEditor offers the ability to specify the max characters lenght that will be submitted to the server by setting the MaxTextLength and MaxHtmlLength properties. This is very useful in database scenarios when the max content length of RadEditor should be set to not exceed the specified characters lenght of the database field.
The MaxTextLength property restricts only the text length of the content without checking the HTML markup, while the MaxHtmlLength property restricts the content along with the HTML markup.

Note: In order to not decrease typing, editing and pasting performance both properties check the characters length only when submitting the content.

Related Resources

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="C#" Theme="Default" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs"Inherits="Telerik.Web.Examples.Editor.MaxContentLength.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>Telerik ASP.NET Example</title>
<link href="../Common/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-wide">

        <telerik:RadEditor RenderMode="Lightweight" runat="server" MaxTextLength="150" ID="RadEditor1" SkinID="DefaultSetOfTools" Width="800px">
            <Modules>
                <telerik:EditorModule Name="RadEditorStatistics" Visible="true"></telerik:EditorModule>
            </Modules>
        </telerik:RadEditor>

        <telerik:RadButton RenderMode="Lightweight" ID="Button1" runat="server" Text="Submit"></telerik:RadButton>
        <span>(The text length of the RadEditor control below is restricted to 150 characters.)</span>
    </div>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?