I have a CostCenter ComboBox trying to grab an ID of the selected item from CompanyCode comboBox and pass it into an URL, but I don't understand why I keep getting "undefined" in the URL.
---JS---
$("#companyCode").width(500).kendoComboBox({
placeholder: "Select...",
dataTextField: "CompanyDescription",
dataValueField: "Id",
autobind: false,
template: "#: data.CompanyCode# - #: data.CompanyDescription#",
dataSource: {
serverFiltering: true,
transport: {
read: {
url: "./CompanyCodeCostCenter/GetAll",
// the request type
type: "get",
// the data type of the returned result
dataType: "json",
}
}
},
change: function () {
companyCodeId = this.value();
}
});
$("#costCenter").width(500).kendoComboBox({
placeholder: "Select...",
dataTextField: "CostCenterDescription",
dataValueField: "Id",
template: "#: data.CostCenterNo# - #: data.CostCenterDescription#",
autobind: false,
cascadeFrom: "companyCode",
dataSource: {
serverFiltering: true,
transport: {
read: {
url: "./CompanyCodeCostCenter/Get" + companyCodeId,
// the request type
type: "get",
// the data type of the returned result
dataType: "json",
},
parameterMap: function (data, type) {
if (type == "read" &&
data.filter != undefined &&
data.filter.filters != undefined ){
var filter = data.filter.filters;
return {
id: filter[0].value,
}
}
}
}
}
});
---Controller---
public virtual JsonResult Get(int id)
{
SetUser();
var vo = _viewService.Get(id);
ExpirePage();
return Json(vo, JsonRequestBehavior.AllowGet);
}
---Result---
http://localhost/Tax/CompanyCodeCostCenter/Getundefined?id=21
I'm very new to JS & Kendo. If possible, please explains in detail. Thank you