All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
New to Telerik UI for ASP.NET AJAX? Download free 30-day trial
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.
<%@ 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> <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>