Kendo MVC Grid: Creating a Custom command button and passing parameters

前端 未结 1 1617
时光说笑
时光说笑 2021-01-04 18:45

I\'m trying to create a custom command button to fire a custom delete function. I need to pass the ID of my model to my custom delete function. You\'ll notice that I\'m tryi

相关标签:
1条回答
  • 2021-01-04 19:17

    This should send any Data keys specified:

    command.Custom("Delete").SendDataKeys(true).Click("PropertyPage.DeleteProperty");
    

    DataKeys are specified in the DataSource section:

        .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.Id))  // THIS IS YOUR DATA KEY
        .Read(read => read.Action("PropertyRead", "Property"))
        .Update(update => update.Action("Update", "Property"))
        .Destroy(update => update.Action("Delete", "Property"))
    

    I also found this page on Kendo's site. It helped me out when I was having a similar issue: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/migration/widgets/grid#editing

    Hope this helps!

    0 讨论(0)
提交回复
热议问题