Sebastian
Sebastian

Reputation: 627

Disable Kendo mvc Multiselect

I have a kendo multiselect on a page and I want to disable it based on a certain criteria. Is it posible to do that ? If not, could you please tell me a workaround for it ?

Thank you

Upvotes: 1

Views: 7769

Answers (2)

Alaa Masoud
Alaa Masoud

Reputation: 7135

var multiselect = $("#multiselect").data("kendoMultiSelect");
multiselect.enable(false);

Docs: http://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect#methods-enable

Upvotes: 5

Win
Win

Reputation: 62260

I want to disable it based on a certain criteria

If you want to disable at server-side, you can use Enable. Otherwise, you can use @Alaa Masoud's answer to disable at client-side.

For example,

@(Html.Kendo().MultiSelectFor(model => model.Ids)
    .BindTo(Model.AvailableNames)
    .DataTextField("Text")
    .DataValueField("Value")
    .Enable(Model.IsActive))

Upvotes: 1

Related Questions