0

如何用剑道填充网格......

这是我的控制器它的工作

  public JsonResult listarporfecha([DataSourceRequest] DataSourceRequest request, string anio, string mes)
        {
        List<Reporte1Hist> reporte = new List<Reporte1Hist>();
        DateTime fecha;
        DateTime time;
        short dia = 31;
        short year = Convert.ToInt16(anio);
        short m = Convert.ToInt16(mes);
        //   string date = anio + "-" + mes + "-" + dia;
        DateTime fdate;
        string MyString;
        try
        {
            if (mes == null && anio == null)
            {
                fecha = DateTime.Now;

            }
            else
            {
                time = new DateTime(year, m, dia);


                reporte = contexto.Reporte1Hist.Where(p => p.Fecha == time).ToList();
            }


        }
        catch (Exception)
        {


            throw;

        }
        return Json(new[] { reporte }.ToDataSourceResult(request, ModelState));

    }

这是我的jquery,它不起作用,

 var url = '@Url.Action("listarporfecha","Home")';

     $.post(url, { anio: year, mes: month }, function (data) {



         $("#Grid").kendoGrid({
             dataSource: {
                 transport: {
                     read: {
                        type:"POST",
                         url: '@Url.Action("listarporfecha","Home")',
                         dataType: "json",
                         data:data
                     }
                 }
             //    schema: {
               //      data: "data"
                 //}
            }
         });

     });
4

0 回答 0