Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to show my JSON object data in kendo grid.

C#
function Shipdata() {
    alert("HI");
    var js = {
        data: [{
            "Special_Requirement_Id": 105,
            "Instruction": "asd",
            "Expected_Result": "asd",
            "Active": true, "hasUpdate": false
        }, {
            "Special_Requirement_Id": 106,
            "Instruction": "2",
            "Expected_Result": "2",
            "Active": true, "hasUpdate": false
        }, {
            "Special_Requirement_Id": 115,
            "Instruction": "sdds",
            "Expected_Result": "sdfsd",
            "Active": true, "hasUpdate": false
        }]
    ,
        "Total": 3,
        "AggregateResults": null,
        "Errors": null
    };
    return JSON.stringify(js);
}

This is my JavaScript function returning Jason data
VB
@(Html.Kendo().Grid<SpecialRequirementViewModel>()
                                                .Name("shipgrid")
                                                .HtmlAttributes(new { style = "width:500px;" })
                                                .Columns(columns =>
                                                {
                                                    columns.Bound(p => p.Instruction).Title("Instruction").Width(130).HtmlAttributes(new { title = "#= Instruction #" });
                                                    columns.Bound(p => p.Expected_Result).Title("Expected Result").Width(130).HtmlAttributes(new { title = "#= Expected_Result #" }); ;
                                                    columns.Bound(p => p.Active).ClientTemplate("<input type='checkbox' disabled='true' id='SelectedSG' #= Active ? checked='checked' : '' # />").Title("Active").Width(80);

                                                })
                                                .Scrollable()
                                                .Resizable(resize => resize.Columns(true))
                                                .Editable(ed => ed.Mode(GridEditMode.PopUp))
                                                .Selectable(selectable => selectable
                                                    .Mode(GridSelectionMode.Single)
                                                    .Type(GridSelectionType.Row))
                                                .DataSource(
                                                dataSource => dataSource
                                                .Ajax()
                                                .ServerOperation(false)
                                                .Sort(sort => sort.Add("Special_Requirement_Id").Descending())
                                                .Model(model => model.Id(p => p.Special_Requirement_Id))
                                                .Read(read => read.Data("Shipdata"))

                                                )

                                                )


this is code for kendo grid. alert is displaying properly by data is not coming in grid. any body can suggest?
Posted
Updated 19-Sep-14 0:03am
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900