I have a problem when i try to load my data after choosing one item from my features list, i'm using Ajax and my Jsonresult is fine, after a few debugging tests, but how can i tell the grid to load my data correctly, i'm using code instead of the filter Junction.
Here is my Controller :
public JsonResult OptionData(Features Option)
{
try
{
List<Data> ls = new List<Data> { };
foreach (var item in db.Data.ToList())
{
if (item.Feature_ID== Option.Feature_ID)
ls.Add(item);
}
return new JsonResult()
{
Data = ls,
MaxJsonLength = Int32.MaxValue,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
catch (Exception e)
{
return Json(e.Message);
}
}
And my Dropdown List in View
var dropdown = grid.find("#Feature).kendoDropDownList({
dataTextField: "Feature_Name",
dataValueField: "Feature_ID",
autoBind: false,
optionLabel: "All",
dataSource: Shared_Data,
change: function () {
var value = this.value();
if (value) {
Selected_Data = value;
$.ajax({
data: {"Feature_ID":Selected_Data },
url: "/KhachHang/DanhSachKhachTheoLoai",
type: "GET",
dataType: "json",
success: function()
{
}
});
} else {
Selected_Data = value;
grid.data("kendoGrid").dataSource.filter({});
}
}