[英]Specified method is not supported in Aspx Web Page
I have a ASPxGridView
and I am using its delete confirmation like: 我有一个ASPxGridView
并且正在使用其删除确认,例如:
grdList.SettingsBehavior.ConfirmDelete = true;
grdList.SettingsText.ConfirmDelete = "Record will be deleted. Do you want to continue?";
When the customer hits the delete button 当客户点击删除按钮时
"Specified method is not supported" “不支持指定的方法”
is throwed. 被抛出。 When I test the page, its works how it should be. 当我测试页面时,它的工作原理应该如何。
Do you have any idea of what may cause that error? 您是否知道可能导致该错误的原因? We both use IE. 我们都使用IE。
Thank you. 谢谢。
Specified method is not supported thrown when deleting ASPxGridView
row usually indicates that the corresponding command is not specified when the grid control tries to execute delete command against underlying data source. 删除ASPxGridView
行时, 不支持抛出指定的方法,通常表示当网格控件试图对基础数据源执行delete命令时,未指定相应的命令。 If you're using custom data source, take note to this explanation: 如果您使用的是自定义数据源,请注意以下说明:
When binding ASPxGridView with custom/non-declarative data sources, they may not have implemented the CRUD operations logic (ie, there are no rules that describe how to automatically update a particular item). 将ASPxGridView与自定义/非声明性数据源绑定时, 它们可能未实现CRUD操作逻辑 (即,没有规则描述如何自动更新特定项目)。
To fix this issue, you can handle RowDeleting
event and set Cancel
property to true to cancel updating operation as follows: 若要解决此问题,可以处理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();
}
Note that Cancel
property should always be set to true
, either in finally
block or before any part of code which potentially raise exception. 注意,在finally
块中或在可能引发异常的任何代码部分之前, Cancel
属性应始终设置为true
。
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;
}
}
Additional references: 其他参考:
Specified method is not supported on deleting GridView row 删除GridView行不支持指定的方法
How to implement CRUD operations with a custom data source 如何使用自定义数据源实现CRUD操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.