We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Maxlength property


How to set maxlength property when the edit type is string?


1 Reply

MK Mahalakshmi Karthikeyan Syncfusion Team February 4, 2016 12:41 PM UTC

Hi Jorge,

We can achieve this requirement with workaround by binding the keypress event to the unique id of editing element. Please refer the below code example for details.

<ej:TreeGrid ID="Treegrid" runat="server" EnableResize="true" //… >



<script type="text/javascript">


        $(document).on("keypress", "#TreegridName", function (e) {

            var CharLength = $(e.target).val().length + 1;

            if (CharLength > 5) {             

                e.returnValue = false;

                if (e.preventDefault)





In the above we have restricted the “Name” field to enter above 5 characters. We have also prepared a sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/Maxlength-143303496


Mahalakshmi K.

Live Chat Icon For mobile
Up arrow icon