Yuu
Yuu

Reputation: 619

Disabled Kendo DropDownList in Javascript

Hi I'm trying to accomplished to disabled the KendoDropDownList via javascript. I already did it but my problem is when I try to populate the KendoGrid the KendoDropDownList is disabled but the value is gone. Anyone know how to fix this? or Anyone know other way to do accomplished this ?

Heres my code:

<script>
  $(document).ready(function () {
      var url = "@Url.Action("CheckUserStatus", "Maintenance")";
      var checkData = "CheckUser";
      $.post(url, checkData, function (d) {
          if (d != 0) {
              // alert(d);

              $("#office_id").data("kendoDropDownList").value(d);
              document.getElementById("mode-status").innerHTML = "Update Program";
              document.getElementById("button-status").innerHTML = "Update Program";
              $("#grd_ApprovedBudget").data("kendoGrid").dataSource.read();
              $("#office_id").kendoDropDownList({
                  enable: false
              });


          }
          //alert(d);

      })
  });
</script>

Upvotes: 0

Views: 3218

Answers (1)

The_Black_Smurf
The_Black_Smurf

Reputation: 5269

When you call $("#office_id").kendoDropDownList, it will try to create a new instance of kendoDropDownList. If you want to disable an existing kendoDropDownList, you'll have to do it using the enable function of the existing instance:

$("#office_id").data("kendoDropDownList").enable(false);

Here's kendo documentation about the enable function.

Upvotes: 1

Related Questions