Is there any option to set content size as Inches in RAD Editor?

2 posts, 0 answers
  1. Saravanan
    Saravanan avatar
    6 posts
    Member since:
    Oct 2012

    Posted 30 Oct 2012 Link to this post


    We have one senrario ,  
    Is there any option to set page size in radeditor, If its exceed more than the page size we should not allow the user to enter.

    The user enter the content in to the RAD Editor Content Box, If the content exceed more than 6 inches in Height (Page Size), The user trying to do Export PDF, by that time  I need to send the validation message. Your page size is more than 6 inches . 

    "This Validation has to be done before Export PDF

    How can handle the validation in Rad Editor. 

    Saravanan M
  2. Rumen
    Rumen avatar
    14324 posts

    Posted 31 Oct 2012 Link to this post


    RadEditor does not offer the required feature built-in because the HTML markup is just a string it is not able to determine if the text entered will fit in a certain amount of space. However, you can enhance the provided code below to fit your scenario. Here is a basic example on how to limit the line length in the editor content area:

    <script type="text/javascript">
    function checkEditor(editor, ev)
    var targetHeight = editor.get_document().body.scrollHeight;
    var allowedHeight = editor.AllowedHeight;

    if (targetHeight > allowedHeight)
    alert("Maximum allowed size content height is 350 pixels");

    if (ev)
    ev.returnValue = false;
    ev.cancelBubble = true;

    return false;
    return true;

    function OnClientCommandExecuted(editor,commandName, tool)
    var allow = checkEditor(editor);

    if (false == allow)

    function OnClientLoad(editor)
    //Set content area to be one inch high
    var iframe = editor.get_contentAreaElement(); = "350px"; = "1px solid red";

    editor.AllowedHeight = iframe.offsetHeight;

    var resizeFnRef = function (e){checkEditor(editor, e)};

    editor.attachEventHandler("keydown", resizeFnRef);

    <telerik:RadEditor id="RadEditor1"
    Height = "350px"
    OnClientCommandExecuted = "OnClientCommandExecuted"

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top