如何解决ObjectDataSource 找不到具有参数的非泛型方法
我有一个绑定到 DevExpress FileManager 的 ObjectDataSource 的问题。我一直在寻找类似情况下的解决方案,但我找不到如何修复它。正如标题所说,ObjectDataSource 正在观察具有此定义的方法:
Public Shared Sub DeleteUpdateDocumento(IDDocumento As Integer,GUID As String,IDNodo as Integer)
这是真正的定义:
Public Shared Sub DeleteUpdateDocumento(IDDocumento As Integer,GUID As String)
如您所见,我没有 IDNodo 参数,但 ObjectDataSource 需要它。这是我的 .aspx 中的 ObjectDataSource 定义:
<asp:ObjectDataSource ID="OdsSmart" runat="server" TypeName="Negocio.Empresas.SmartBoxes"
OnSelecting="OdsSmart_Selecting"
OnSelected="OdsSmart_Selected"
OnUpdating="OdsSmart_Updating"
OnDeleting="OdsSmart_Deleting"
SelectMethod="GetDocumentosSmartBoxes"
InsertMethod="InsertUpdateDocumento"
DeleteMethod="DeleteUpdateDocumento" >
<SelectParameters>
<asp:Parameter Name="IDUsuario" Type="Int32" DefaultValue=""></asp:Parameter>
<asp:Parameter Name="IDEmpresa" Type="Int32" DefaultValue=""></asp:Parameter>
<asp:Parameter Name="Tipo" Type="String"></asp:Parameter>
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="IDDocumento" Type="Int32"></asp:Parameter>
<asp:Parameter Name="IDSmartBox" Type="Int32"></asp:Parameter>
<asp:Parameter Name="IDEmpresa" Type="Int32"></asp:Parameter>
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="IDDocumento" Type="Int32"></asp:Parameter>
<asp:Parameter Name="GUID" Type="String"></asp:Parameter>
</DeleteParameters>
</asp:ObjectDataSource>
最后这是事件处理程序:
Protected Sub OdsSmart_Deleting(sender As Object,e As ObjectDataSourceMethodEventArgs)
Try
Dim idFichero As Integer = 0
idFichero = ExtractIdSelectedElement(FmSmartBoxDocumentos.SelectedFile.Id,"FILE")
Using dtResult As DataTable = Negocio.Ficheros.Ficheros.GetGUIDFicheroById(idFichero)
If dtResult.Rows.Count > 0 Then
e.InputParameters("IDDocumento") = idFichero
e.InputParameters("GUID") = dtResult.Rows(0)("GUID")
'OdsSmart.DeleteParameters("IDDocumento").DefaultValue = idFichero
'OdsSmart.DeleteParameters("GUID").DefaultValue = dtResult.Rows(0)("GUID")
'OdsSmart.Delete()
End If
End Using
Catch ex As ThreadAbortException
Rellenar.MensajeDesdeCallback(sender,"Error al eliminar documento.<br>Póngase en contacto con el adminisTrador.",TiposMensaje.Fallo)
Catch ex As Exception
Rellenar.MensajeDesdeCallback(sender,TiposMensaje.Fallo)
End Try
End Sub
DeleteUpdateDocumento() 方法位于 Negocio.Empresas.SmartBoxes 中,所以这是正确的。这是异常堆栈跟踪:
zh System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type,String methodName,IDictionary allParameters,DataSourceOperation operation) zh System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete(IDictionary keys,IDictionary oldValues) zh System.Web.UI.DataSourceView.Delete(IDictionary keys,IDictionary oldValues,DataSourceViewOperationCallback callback) zh DevExpress.Web.DataSourceFileSystemProvider.DeleteEntity(FileManagerBoundEntity entity) zh DevExpress.Web.DataSourceFileSystemProvider.DeleteFile(FileManagerFile 文件) zh DevExpress.Web.Internal.RestrictedAccessFileSystemProvider.DeleteFile(FileManagerFile file) zh DevExpress.Web.Internal.FileManagerEditHelper.DeleteFile(FileManagerFile 文件) zh DevExpress.Web.Internal.FileManagerDeleteItemsCommand.DeleteSelectedItems()
我不知道我做错了什么。请问有人可以帮我吗?
提前致谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。