You can send additional data with the transport.read.data
object (see Kendo documentation here). Your datasource might look like this:
datasource = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "@Html.Raw(Url.Action("actionmethod", "controllername", new { @ID= id }))",
type: "POST",
dataType: "json"
data: { data: $('#dropdownid').val() }
}
},
schema: {
model: {
id: "id",
hasChildren: "hasChildren",
//expanded: true
}
}
});
You could also provide a function name to data
(for example getDropDownId()
), rather than $('#dropdownid').val()
to provide more robust code (null checks, etc).