首页 > 解决方案 > Devexpress Gridview 中的按钮没有响应

问题描述

我需要在使用GridViewCommandColumnCustomButton属性创建的删除按钮上设置确认消息。将客户端事件添加到我的网格后,其他按钮(在同一个 AspxGridview 内)不会触发事件,但 Delete 按钮除外。

我为消息创建的事件是:

grid.ClientSideEvents.CustomButtonClick = "function (s, e) { if (e.buttonID == 'DELETE'){ e.processOnServer = confirm('Are you sure you want to delete this item?'); }}";

如果我从服务器端删除代码,所有按钮触发事件并按预期工作,但如果我添加上述代码,删除按钮将正常工作,但其他按钮不会触发任何事件。

PS:所有的按钮也是用同样的方法创建的

标签: asp.netdevexpress

解决方案


我更新了如下代码。现在它起作用了。

grid.ClientSideEvents.CustomButtonClick = "function (s, e) { if (e.buttonID == 'DELETE'){ e.processOnServer = confirm('Are you sure you want to delete this Voucher?');} "+
                                                      " else if  (e.buttonID == 'EDIT'){ e.processOnServer = true; } " +
                                                      " else if  (e.buttonID == 'UPDATE'){ e.processOnServer = confirm('Are you sure you want to Update this Voucher?'); }  }";

除了任何简单的答案,请分享!

谢谢 :)


推荐阅读