kendo grid delete command not working

前端 未结 5 1801
青春惊慌失措
青春惊慌失措 2020-12-31 04:57

i have developed a web application using kendo ui tools and theres a kendo grid with batch edit mode..

but when i press the delete

5条回答
  •  梦毁少年i
    2020-12-31 05:24

    I had put an arbitray name for an int on the server Delete Method.

        [HttpPost]
        public ActionResult DeleteRandomTest(Int32 randomTestId)
        {
             ...
        }
    

    The default modelbinder was probably looking for a property called Id (same as the primary key of my type according to the configuration of the model).

     .Model(config => config.Id(p => p.Id))
    

    In fact, I proved this by changing the signature to the following:

        [HttpPost]
        public ActionResult DeleteRandomTest(Int32 Id)
        {
            ...
        }
    

    My break point was hit after that.

    Ultimately, I used the full type as the parameter as shown in the Kendo examples because I didn't want to have poorly named parameter names (not camel case) in the action. Shown as follows:

        [HttpPost]
        public ActionResult DeleteRandomTest([DataSourceRequest]
             DataSourceRequest request, RandomDrugTest randomDrugTest)
        {
           ...
        }
    

    This seems to the be the reason it wasn't working.

提交回复
热议问题