Skip to main content
 首页 » 编程设计

c#之telerik radgrid GridView1_ItemInserted之我可以获得返回值吗

2024年02月24日2298°冷暖

我有一个使用对象数据源进行插入的 telerik radgrid。 objectdatasource 调用的插入方法有一个 bool 返回值,我想在 radgrid 的 ItemInserted 事件中检查它。

这是否可能,执行此操作的代码是什么。我检查了 GridInsertedEventArgs e,我无法看到返回值,但它必须存在,我想我只是错过了它。

如有任何帮助,我们将不胜感激。

请您参考如下方法:

ItemInserted事件最好与异常一起使用,因此它包含一个 Exception和 ExceptionHandled属性(property)。

如果您的对象数据源插入方法失败(我相信这就是 bool 返回值的意图),您应该抛出一个 Exception您可以在 ItemInserted 中检查的特定类型事件。

然后根据异常的类型,可以选择修改ExceptionHandled属性(property)和KeepInInsertMode的 Telerik.Web.UI.GridInsertedEventArgs参数。