I'm trying to call an MVC controller action to populate my grid and I need to pass a parameter to it. However, my breakpoint in the action isn't getting hit. Am I doing something wrong here? I can't tell if my param is making it through since my breakpoint isn't getting hit. Do I need to set up a route for this call?
Action:
[HttpGet]
public JsonResult GetSalesHistory(string id)
{
List<Sales> sales = PestsLogic.GetSalesById(5);
return Json(new { data = sales, total = sales.Count }, JsonRequestBehavior.AllowGet);
}
JavaScript code:
<script type="text/javascript">
$("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "Sales/GetSalesHistory",
dataType: "json",
type: "GET",
contentType: "application/json; charset=1-8",
data: { id: "@ViewBag.CustomerEstimateKey" }
}
},
pageSize: 15,
schema: {
data: "data",
total: "total"
}
},
pageable: true,
sortable: true
});
</script>
Action:
[HttpGet]
public JsonResult GetSalesHistory(string id)
{
List<Sales> sales = PestsLogic.GetSalesById(5);
return Json(new { data = sales, total = sales.Count }, JsonRequestBehavior.AllowGet);
}
<script type="text/javascript">
$("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "Sales/GetSalesHistory",
dataType: "json",
type: "GET",
contentType: "application/json; charset=1-8",
data: { id: "@ViewBag.CustomerEstimateKey" }
}
},
pageSize: 15,
schema: {
data: "data",
total: "total"
}
},
pageable: true,
sortable: true
});
</script>