Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
TextBoxProvider with multilien
posted

Hi

Does TextBoxProvider with TextMoe="Multiline" support maxlength property.

Eventhough i set the maxlength property it is accepting more than the max length

Am i doing anything wrong or maxlength property is ignored when the the Text mode is set to Multiline

Regards

Jojesh

Parents
  • 20255
    Offline posted

    Hello Jojesh,

     About the TextBoxProvider MaxLength property, if the TextMode is SingleLine, then you can set the MaxLength to be 5 for example, and this will limit the input to be only 5 characters. MaxLength has no affect when TextMode is Multiline.

    To limit the number of characters on a multiline editor then you would need to use BLOCKED SCRIPT

    function WebDataGrid1_Grid_Initialize(sender, eventArgs) {
            var editor = document.getElementById("TextEditor");
            editor.onkeydown = function (e) {
                if (e.keyCode == 8 || e.keyCode == 46)
                    return true;

                if (editor.value.length >= 5)
                    return false;
            };
        }

      First of all, give a Static id to the editor provider:

    <EditorProviders>
              <ig:TextBoxProvider ID="WebDataGrid1_TextBoxProvider1">
                     <EditorControl ID="TextEditor" ClientIDMode="Static" MaxLength="5" TextMode="MultiLine" Rows="5"></EditorControl>
               </ig:TextBoxProvider>
     </EditorProviders>


     If you have any other question, do not hesitate to contact me!

     

Reply Children