1
votes

I am using kendo ui controls for the first time in mvc.

1> @Html.Kendo().TextBoxFor(model => model.field).Name("txtFirstName")

how do I reset the value to empty string and disable a kendo textboxfor using jquery?

for some controls I am able to do something like this, but for the kendo.Textbodfor() I donot know what to pass in the .data()

var txtLastName= $("#LastName").data("kendoAutoComplete");

txtLastName.value("");

txtLastName.enable(false);

2> this partial view only renders a textbox - how to reset the value to an empty string and disable the textbox rendered by the partial view

<li>@Html.Partial("~/Views/xyz/_AutoComplete.cshtml")</li>
1

1 Answers

0
votes

When using @Html.Kendo().TextBoxFor the generated output doesn't generate a Kendo widget it is simply an input element.

You just need to use some jQuery or Javascript to do what you want.

$('#txtFirstName').removeAttr("value")
$('#txtFirstName').prop("disabled", "disabled")