Editor Causes Ajax To Get Stuck In Loop

2 posts, 0 answers
  1. Michel Laforce
    Michel Laforce avatar
    10 posts
    Member since:
    Apr 2010

    Posted 31 Oct 2011 Link to this post


    the RadEditor is inside a AjaxUpdatedControl, I have the MaxTextLenght set and when it is exceeded, the message appears (the added text exceeded...), after the ajax loading panel appears but it gets stuck in an infinite loopthere. How can I stop this.

  2. Rumen
    Rumen avatar
    14431 posts

    Posted 31 Oct 2011 Link to this post

    Hi Michel,

    We are aware of this issue, but there is not a solution for this scenario.

    Nevertheless, you can write your own validation mechanism similar to the following one:

    Here is an example for multiple editors on the page:
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="LimitCharacters"></telerik:RadEditor>
    <telerik:RadEditor ID="RadEditor2" runat="server" OnClientLoad="LimitCharacters"></telerik:RadEditor>
    <telerik:RadEditor ID="RadEditor3" runat="server" OnClientLoad="LimitCharacters"></telerik:RadEditor>
      <script type="text/javascript">
      var editorList = new Object();
      var editorLengthArray = [20,30,40];
      var counter = 0;
      function isAlphaNumericKey(keyCode)
       if ((keyCode > 47 && keyCode < 58) || (keyCode > 64 && keyCode < 91))
        return true;
       return false;
      function LimitCharacters(editor)
          editorList[editor.get_id()] = editorLengthArray[counter];
          editor.attachEventHandler("onkeydown", function(e)
            e = (e == null)? window.event : e;
            if (isAlphaNumericKey(e.keyCode))
                var maxTextLength = editorList[editor.get_id()];
                textLength = editor.get_text().length;
                if (textLength >= maxTextLength)
                    alert('You are not able to type more than ' + maxTextLength + ' symbols!');
                    e.returnValue = false;
    Just type in the content area to see the alert message.

    or this provided with the Custom Validator in the following demo: Validator Support, e.g.

    <telerik:radeditor runat="server" ID="RadEditor1"></telerik:radeditor>
    <asp:CustomValidator runat="server" ID="CustomValidator1" ControlToValidate="RadEditor1" ClientValidationFunction="checkLength">* The text length should not exceed 50 symbols.</asp:CustomValidator> 
    <script type="text/javascript"
        var limitNum = 50; 
        function checkLength(sender, args) 
            //Note that sender is NOT the RadEditor. sender is the <span> of the validator.
            //The content is contained in the args.Value variable    
            var editorText = args.Value;
            args.IsValid = editorText.length > limitNum; 

    Best wishes,
    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