dotnet-practitioner
dotnet-practitioner

Reputation: 14148

Kendo UI numeric text box value based on Grid row selection

I am able to extract the desired value from selected row in the kendo ui grid but I am unable to refresh the numeric text box value based on that selection. Here is my code to set the value:

    function OnChangeDivTimberGradeGrid(arg) {
        var selected = $.map(this.select(), function (item) {
            var grade = $(item).text().substring(0, 3);
            alert(grade);
            var numerictextbox = $("#TimberGrade").data("kendoNumericTextBox");
            numerictextbox.value(grade);

        });
    }

and here is how I define the numeric text box.

<p>Timber Grade =  @(Html.Kendo().AutoCompleteFor(x => x.TimberGrade)
    .Name("TimberGrade")
    .Value("C16")
) 
</p>

Upvotes: 0

Views: 2488

Answers (1)

CSharper
CSharper

Reputation: 5590

Try this:

$("#TimberGrade").val(grade);

edit:

var numerictextbox = $("#TimberGrade").data("kendoNumericTextBox");

is not correct. the data portion is off. It should be

$("#TimberGrade").data("kendoAutoComplete");

First you must clear the value, then you can set it.

$("#input").data("kendoAutoComplete").value(""); 
$("#input").data("kendoAutoComplete").value(grade);

I think that will work

Upvotes: 1

Related Questions