checkboxes: { checkChildren: true },in the:
var dropdownDataSource = new kendo.data.DataSource({
transport: {
read: {
url: "Tenant/ProductList",
contentType: "application/json; charset=utf-8",
dataType: "json",
type: "post"
}
},
schema: {
model: {
id: "ProductID",
fields: {
ProductID: { editable: false, nullable: true },
ProductName: { editable: false }
}
}
}
});
var dropDownList = $("#ProductList").kendoDropDownList({
optionLabel: "Select product...",
name: "ProductID",
dataTextField: "ProductName",
dataValueField: "ProductID",
dataSource: dropdownDataSource
}).data("kendoDropDownList");
@{ if (Session["VendorList"] != null) { List<PA.Service.AdminTools.VendorDTO> vendors = (List<PA.Service.AdminTools.VendorDTO>)Session["VendorList"]; @(Html.Kendo().PanelBar() .Name("Vendors") .ExpandMode(Kendo.Mvc.UI.PanelBarExpandMode.Multiple) .Items(panelbar => { panelbar.Add().Text("Vendors") .Expanded(true) .Enabled(true) .Items(items => { foreach (var vendor in vendors) { if (vendor.IsDefault) { items.Add() .Text(vendor.VendorName) .HtmlAttributes(new { onclick = "SetVendorID("+vendor.VendorID.ToString()+")" }) .Selected(true); } else { items.Add() .Text(vendor.VendorName) .HtmlAttributes(new { onclick = "SetVendorID(" + vendor.VendorID.ToString() + ")" }) .Selected(false); } } }); }) ) } }
<
script
type
=
"text/javascript"
src
=
"~/Scripts/kendoui/kendo.all.min.js"
></
script
><
link
href
=
"content/kendoui/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"content/kendoui/kendo.default.min.css"
rel
=
"stylesheet"
/>
<
div
id
=
"example"
class
=
"k-content"
>
<
div
id
=
"vendors"
>
<
input
id
=
"searchQuery"
/>
</
div
>
<
script
>
$(document).ready(function () {
$("#searchQuery").kendoAutoComplete({
minLength: 3,
dataTextField: "Name",
dataSource: {
minLength: 3,
type: "json",
transport: {
read: {
url: "http://localhost:2168/Search.svc/SearchVendorsByName",
dataType: "json",
type: "GET",
contentType: "application/json",
},
parameterMap: function (options) {
return "searchQuery=" + $('#searchQuery').val();
},
}
}
});
});
</
script
>
<
style
scoped>
#vendors {
width: 369px;
height: 71px;
padding: 211px 0 0 141px;
margin: 30px auto;
}
.k-autocomplete {
width: 240px;
vertical-align: middle;
}
</
style
>
</
div
>
[{
"ID"
:
1
,
"Name"
:
"Vendor Name"
},{
"ID"
:
2
,
"Name"
:
"Vendor Name"
},{
"ID"
:
3
,
"Name"
:
"Vendor Name"
},{
"ID"
:
4
,
"Name"
:
"Vendor Name"
},{
"ID"
:
5
,
"Name"
:
"Vendor Name"
},{
"ID"
:
6
,
"Name"
:
"Vendor Name"
},{
"ID"
:
7
,
"Name"
:
"Vendor Name"
},{
"ID"
:
8
,
"Name"
:
"Vendor Name"
},{
"ID"
:
9
,
"Name"
:
"Vendor Name"
},{
"ID"
:
10
,
"Name"
:
"Vendor Name"
}]