Click here to Skip to main content
15,112,866 members
Articles / Programming Languages / C#
Posted 29 Jan 2016


1 bookmarked

Kendo UI NumericTextBox Enable/Disable Issue

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
29 Jan 2016CPOL
Kendo UI NumericTextBox Enable/Disable issue solved

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.


This trick will help you sort out the issue of enabling/disabling (for Kendo UI NumericTextBox).


One of the best things of using a Kendo UI NumericTextBox is that you need not write custom validation separately to allow only Numbers (where the user input has to be Numeric) - however there is a caveat - the enable/disable functionality then, is not as simple as in case of a traditional / any other normal Textbox, for that matter. (I learned it the hard way though... after wasting a lot of time!!).

I needed to disable all AgenctFeeOverrides Textboxes when the repfirmDefault was empty.

Using the Code

// Kendo NumericTextBox html
@(Html.Kendo().NumericTextBoxFor(model => model.AgencyFeeOverride)
.HtmlAttributes(new { style = "width: 85px;font-size:10px;line-height:2em;",
id=Model.OrderDetailId.ToString() + "_agencyFeeOverride" })
.Enable(@Model.AgencyFeeDefault != null && 
@Model.IsViewReadOnly.ToString().ToLower() == "false")

$(document).ready(function () 
    //Get Default value
    var repFirmDefault = $('#RepFirmNameDefault').text();
    //Get all AgencyFeeOverrideList
    var agencyFeeList = $('[id*=_agencyFeeOverride]');
    //To disable _agencyFeeOverride kendoNumericTextBox 
    if (repFirmDefault=="") 
            for (var i = 0; i < repFirmFeeList.length; i++) 
                var numerictextbox = $(repFirmFeeList[i]).data("kendoNumericTextBox");


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Yogesh Jamkhindikar
Software Developer (Senior)
United States United States
I love to code (ASP.NET-C#, SQL, AJAX, HTML, XML, WCF, MVC, JQuery, Kendo, REST Services, Business Analysis are my favourites to work with),play outdoor sports, travel to places, meet new people, be amidst Nature, read inspirational books, listen to music & am a Foodie as well.

Comments and Discussions

-- There are no messages in this forum --