1
votes

I've got the Kendo Grid calling an MVC action, but my breakpoint in the action isn't getting hit and nothing is getting returned. Any ideas why?

JavaScript:

$("#grid").kendoGrid({
    dataSource: {
        type: "json",
        transport: {
            read: {
                url: "Sales/GetSalesHistory",
                dataType: "json",
                type: "GET",
                data: { id: "@ViewBag.CustomerEstimateKey" }
            }
        },
        schema: {
            data: "data",
            total: "total"
        }
    }
});

Action:

    [HttpGet]
    public JsonResult GetSalesHistory(int id)
    {
        List<Sales> sales = PestsLogic.GetSalesById(id);
        return Json(new { data = sales, total = sales.Count }, JsonRequestBehavior.AllowGet);
    }
2
Have you looked at the request in Fiddler or Firebug? That will tell you if the request is being made, and if it is getting an error. - Dave Swersky
No. I'll give that a shot and report back. - birdus

2 Answers

0
votes

Changing the url property to this fixed it:

'@Url.Action("GetSalesHistory", "Sales")'
0
votes

I had the same issues you did. If you add a leading forward slash in the URL string so it looked like this - URL:"/Sales/GetSalesHistory" it should also work.