Help me! About Json Datatable

#1

When I using json table for my data. I’m done from code C# to View. But when they show web like imge below. They don’t created table json.

  • Code in C#
    public ActionResult listQTTG(string searchString)
    {
    ViewBag.SearchString = searchString;
    string sdd = searchString;
    var list = db.QTTG(sdd).ToList<QTTG_Result>();
    return Json(new { rows = list}, JsonRequestBehavior.AllowGet);
    }
  • Code in View

@section scripts{

<script>
    $(function () {
        $grid = $("#jqGrid").jqGrid({
            url: '@Url.Action("listQTTG", "Quatrinhthamgia")',
            mtype: 'GET',
            datatype: 'json',
            colModel: [
                { label: "Quá trình tham gia", name: "QTTG_BHXH" },
                { label: "Mã CQQL", name: "BUKRS" },
                { label: "Đơn vị", name: "ORGID" },
                { label: "Hệ số", name: "PERC_SI" },

            ],
            loadonce: true

        });
    });
</script>

}
Thanks.

0 Likes