This is a migrated thread and some comments may be shown as answers.

Kendo Grid and MVC3 + JSON

0 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cyr
Top achievements
Rank 1
Cyr asked on 24 Jul 2012, 01:24 AM
I try get data from DataBase.
View:
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $("#grid").kendoGrid(
        {
            groupable: true,
            scrollable: true,
            sortable: true,
            pageable: true,
            filterable: true,
            
            dataSource: {
                type: "json",              
                transport: {
                    read: {
                        url:  "/Item/GetItems",
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json; charset=utf-8"
                    }
                }
            },
  
  
            columns: [
                                { field: "ID", title: "ID" },
                                { field: "InvNo", title: "Инв.номер" }
                     ]
        });
    });
          
</script>

Controller:
public JsonResult GetItems()
        {
            List<SelectListItem> searchParams = new List<SelectListItem>();
            searchParams.Add(new SelectListItem() { Value = "InvNo", Text = "121" });
  
            IList<Item> data = _itemService.GetItems(searchParams);
            return Json(data.ToList(), JsonRequestBehavior.AllowGet);
        }

data is not empty and successful return 12 items, but grid is empty :(((

Sample with createRandomData(50) from people.js is OK.

 

 

 

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Cyr
Top achievements
Rank 1
Share this question
or