Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Please try with the below code snippet.</p> <pre><code>&lt;div&gt; &lt;input id="fabric" placeholder="Select fabric..."&gt; &lt;input id="hf_fabric" type="hidden"&gt; Selected values : &lt;span id="spanfabric"&gt;&lt;/span&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#fabric").kendoDropDownList({ name: "fabric", dataTextField: "DataText", dataValueField: "DataValue", dataSource: [ { DataText: "Select All", DataValue: "0" }, { DataText: "Cotton", DataValue: "1" }, { DataText: "Polyester", DataValue: "2" }, { DataText: "Cotton/Polyester", DataValue: "3" }, { DataText: "Rib Knit", DataValue: "4" } ], filter: "contains", suggest: true, template: "&lt;input type='checkbox' id='chk_fabric_#=data.DataValue #' onclick='UpdateIdinHF(this);' value='#=data.DataValue #' name='fabric' /&gt;" + " " + "${ data.DataText }", close: onClose, change: onChange }); }); var IsItemChecked = false; function UpdateIdinHF(obj) { var id = $(obj).attr('id'); var name = $(obj).attr('name'); var value = parseInt($(obj).attr('value')); var IsChecked = $(obj).is(':checked'); var hf = $("#hf_" + name).get(0); if (value != 0) { UpdateIdInHiddenField(hf, value, IsChecked); var totalchk = $('input[id*="chk_' + name + '"]').not("#chk_" + name + "_0").length; var checkedchk = $('input[id*="chk_' + name + '"]:checked').not("#chk_" + name + "_0").length; if (totalchk == checkedchk) { $("#chk_" + name + "_0").prop("checked", true); } else { $("#chk_" + name + "_0").prop("checked", false); } } else { $('input[id*="chk_' + name + '"]').each(function () { if (parseInt($(this).val()) != 0) { if (IsChecked == true) { $(this).prop("checked", true); UpdateIdInHiddenField(hf, $(this).val(), IsChecked); } else { $(this).prop("checked", false); UpdateIdInHiddenField(hf, $(this).val(), IsChecked); } } }); } IsItemChecked = true; } function onClose(e) { if (IsItemChecked == true) { IsItemChecked = false; e.preventDefault(); } else { ShowSelectedItem(); } } function ShowSelectedItem() { $("#spanfabric").html($("#hf_fabric").val()); } function UpdateIdInHiddenField(hf, id, IsAdd) { if (hf.value == "") { hf.value = ","; } if (IsAdd == true) { if (hf.value.indexOf("," + id + ",") == -1) { hf.value = hf.value + id + ","; } } else if (IsAdd == false) { if (hf.value.indexOf("," + id + ",") &gt;= 0) { hf.value = hf.value.replace("," + id + ",", ","); } } } function onChange(e) { e.sender.value(null); } &lt;/script&gt; </code></pre> <p>if in your page more than one dropdownlist is there then please check below link.</p> <p><a href="http://jayeshgoyani.blogspot.in/2013/06/multi-selection-combobox-in-kendo-ui.html" rel="nofollow">Multi Selection Combobox in Kendo UI</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload