ObjectDataSource 找不到具有参数的非泛型方法

时间:2021-07-21 11:07:41

标签: asp.net devexpress 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, "Error al eliminar documento.<br>Póngase en contacto con el administrador.", 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()

我不知道我做错了什么。请问有人可以帮我吗?

提前致谢。

0 个答案:

没有答案