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.
Unfortunately, activation email could not send to your email. Please try again.

Maxlength property

Thread ID:

Created:

Updated:

Platform:

Replies:

121885 Feb 3,2016 01:05 PM Feb 4,2016 07:41 AM ASP.NET Web Forms 1
loading
Tags: TreeGrid
Jorge Pampin
Asked On February 3, 2016 01:05 PM

Hello,

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

Thanks!

Mahalakshmi Karthikeyan [Syncfusion]
Replied On February 4, 2016 07:41 AM

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" //… >

//…

</ej:TreeGrid>


<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)

                    e.preventDefault();

            }

        });


    </script>

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

Regards,

Mahalakshmi K.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;