0

This is My view with kendo ui grid, It's Read function firing just fine, but the problem just begins when I want to update, The update Function in my controller Not even Firing,

<script>

    $(document).ready(function () {
        var dataSource = {
            transport: {
                type: "json",
                read: {
                    url: "@Html.Raw(Url.Action("CommentList", "Comment"))",
                    type: "POST",
                    dataType: "json"
                },
                update: {
                    url: "@Html.Raw(Url.Action("CommentUpdate", "Comment"))",
                    type: "POST",
                    dataType: "json"
                },
                destroy: {
                    url: "@Html.Raw(Url.Action("CommentDelete", "Comment"))",
                    type: "POST",
                    dataType: "json"
                }
            },
            schema: {
                data: "Data",
                total: "Total",
                errors: "Errors",
                model: {
                    id: "Id",
                    fields: {
                        Id: { type: "number" },
                        ProductName: { editable: false, type: "string"},
                        ProductPicture: { editable: false, type: "string"},
                        Text: { editable: false, type: "string"},
                        AdminConfirm: { editable: true, type: "boolean", validation: { required: true } }
                    }
                }
            },
            requestEnd: function (e) {
                if (e.type === "create" || e.type === "update") {
                    this.read();
                }
            },
            error: function (e) {
                alert("something wrong!");
                // Cancel the changes
                this.cancelChanges();
            },
            pageSize: 15,
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true
        };
        $("#grid").kendoGrid({
            dataSource: dataSource,
            pageable: {
                refresh: true,
                pageSizes: [10, 15, 20, 30, 50]
            },
            height: 550,
            columns: [
                {
                    field: "ProductName",
                    title: "product name",
                    width: "90px"
                },
               {
                   field: "ProductPicture",
                   title: "picture",
                   width: "100px",
               },
                {
                    field: "Text",
                    title: "comment",
                    width: "180px"
                },


                 {
                     field: "AdminConfirm",
                     title: "adminconfirm",
                     width: "70px",

                 },
                {
                    command: [
                        {
                            name: "edit" , text: { // sets the text of the "Edit", "Update" and "Cancel" buttons
                                edit: "edit",
                                update: "update",
                                cancel: "cancel"
                            }
                        }
                    ],
                    title: "&nbsp;", width: "250px"
                }
            ],

            editable  : {
                mode : "popup",
                window : {
                    title: "confirmation form"
                }}
        });
    });

  </script>
 </div>

This is My first line of update Function

    [HttpPost]
       public ActionResult CommentUpdate(DataSourceRequest request, CommentViewModel comment)

Anybody Know Why? Thanx in Advance

Shaheen Zahedi
  • 1,216
  • 3
  • 15
  • 40
  • have you checked using fiddler, browser tools to see if the "update" command is trying to hit an action on your server. When you click the initial update button on your grid it will load the `pop up` but the update command will only fire when you click the save button in the `pop up` – David Shorthose Jun 24 '16 at 11:40
  • Yes I've checked for that, And the update action does not fire at all, Yes I know when the update button must fire,But I think Somewhere On my view , There is something I've done Wrong – Shaheen Zahedi Jun 24 '16 at 13:29

0 Answers0