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

Problem with inline grid editiing and asp.net

2 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mentor Graphics
Top achievements
Rank 1
Mentor Graphics asked on 31 May 2012, 09:07 PM

Hello,
I'm new to Kendo.
I'm trying to implement the following example:
http://demos.kendoui.com/web/grid/editing-inline.html
My server side code is ASP.Net

The problem is that while clicking new/update/delete inline options, i get a request to the server, to the relevant web method, however
no parameters are passed (the request object is empty).

Here is the client side code:
//////////////////////////////////////////////// Ready evet - Datasource
    $(document).ready(function () {
        var MydataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "HttpHandler.aspx/Line2AOIGetData",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json"
                },
                update: {
                    url: "HttpHandler.aspx/Line2AOIUpdate",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json"
                },
                destroy: {
                    url: "HttpHandler.aspx/Line2AOIDelete",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json"
                },
                create: {
                    url: "HttpHandler.aspx/Line2AOICreate",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json"
                },
                parameterMap: function (options, operation) {                   
                    if (operation !== "read" && options.models) {
                        return { models: kendo.stringify(options.models) };
                    }
                }
            },
            batch: false,
            pageSize: 5,
            schema: {
                data: 'd',
                model: {
                    id: "LineName",
                    fields: {
                        LineName: { editable: true, nullable: false, validation: { required: true} },
                        Equipmentname: { editable: true, nullable: false, validation: { required: true} }
                    }
                }
            }
        });

        //////////////////////////////////////////////// Grid
        $("#theGrid").kendoGrid({
            dataSource: MydataSource,
            pageable: true,
            toolbar: ["create"],
            columns: [{ title: "Line", field: "LineName", width: "200px" },
                    { title: "AOI Machine", field: "Equipmentname", width: "200px" },
                     { command: ["edit", "destroy"], title: " ", width: "250px"}],
            editable: "inline",
            scrollable: false
        });
    });

Please advice.
Tnx

2 Answers, 1 is accepted

Sort by
0
Mentor Graphics
Top achievements
Rank 1
answered on 01 Jun 2012, 09:29 AM
Here are some screenshots for better clarification.
(Update/create/delete kendo events are fired, but in the server side (aspx) i get an empty request).
Please advice
0
Mentor Graphics
Top achievements
Rank 1
answered on 03 Jun 2012, 06:34 AM
Found the problem..i made below changes and now everything works.

parameterMap: function (data, operation) {
                    if (operation !== "read") {                       
                        return JSON.stringify({ line: data })
                    }

                }

Server side:
[WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static void Line2AOIUpdate(Line2Aoi line)

 

Tags
Grid
Asked by
Mentor Graphics
Top achievements
Rank 1
Answers by
Mentor Graphics
Top achievements
Rank 1
Share this question
or