ASPX网页中不支持指定的方法



我有一个 ASPxGridView,我正在使用其删除确认,例如:

grdList.SettingsBehavior.ConfirmDelete = true;
grdList.SettingsText.ConfirmDelete = "Record will be deleted. Do you want to continue?";

当客户登录删除按钮

"不支持指定的方法"

被扔了。当我测试页面时,它的工作应该如何。

您是否知道可能导致该错误的原因?我们俩都使用IE。

谢谢。

指定的方法不支持删除ASPxGridView行时抛出通常表示当网格控制尝试执行删除命令反对基础数据源时,未指定相应的命令。如果您正在使用自定义数据源,请注意此说明:

与自定义/非定制数据源绑定AspxGridView时, 他们可能没有实现Crud操作逻辑(即 没有描述如何自动更新特定的规则 项目(。

要解决此问题,您可以处理RowDeleting事件,并将Cancel属性设置为true以取消更新操作,如下所示:

protected void grdList_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
{
    var grid = sender as ASPxGridView;
    // make sure Cancel property set to true
    e.Cancel = true;
    // row deleting code here
    // data rebinding code here
    grdList.DataBind();
}

请注意,Cancel属性应始终设置为true,无论是在finally块中还是在代码的任何部分之前都会提出异常。

protected void grdList_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
{
    var grid = sender as ASPxGridView;
    try 
    {
        // row deleting code here
        // data rebinding code here
        grdList.DataBind();
    }
    catch (Exception e)
    {
        // exception handling
    }
    finally
    {
        // make sure Cancel property set to true
        e.Cancel = true;
    }
}

其他参考:

在删除GridView行

上不支持指定的方法

如何使用自定义数据源实施CRUD操作

最新更新