问题背景:
   在web form中添加了一个detailsView,并在向导中生成了一个名为objComplex的ObjectDataSource,准备用detailsView实现insert,update,select等操作问题:
  1.已经将ObjectDataSource的相关属性做如下修改,但在Insert时始终无法运行对应的类中的方法:ServiceManager.InsertComplex
    相关定义如下:
    <asp:ObjectDataSource ID="objComplex" runat="server" DeleteMethod="DeleteComplex"
        InsertMethod="InsertComplex" OldValuesParameterFormatString="original_{0}" SelectMethod="GetComplexData"
        TypeName="ServiceManager" UpdateMethod="UpdateComplex">
  2.detailsView由向导生成后,已经手工做了大量修改,能否将先前自动成成的ComplexTableAdapters.tblComplexTableAdapter重新生成?因为其中的参数和逻辑与现在已经不匹配了。谢谢

解决方案 »

  1.   

    添加有相应的Button或LinkButton按钮没? 设置其CommandName="Delete"
      

  2.   

    因为有 AutoGenerateInsertButton="True",所以应该不需要手动指定,事实上提交的行为是被出发的。刚刚跟踪了以下代码,发现执行完objComplex_Inserting后,会发生“ObjectDataSource 'objComplex' could not find a non-generic method 'InsertComplex' that has parameters: Meta, ComplexName, Builder_ID, No_Appt, No_Storey, LotId, Description, AGGP_ID, EMP_ID, strCreatedUser, dtCreatedDate, strUpdatedUser, dtUpdatedDate, tTimestamp, strUsername, strHashedPassword, bolPasswordIsHashed, strReturnType, ID, Name, Lot_ID, COM_BLD_nId”的异常。问题的结症应该在于页面提供的参数与被绑定的ServiceManager.InsertComplex函数不匹配,但是页面上并没有ID, Name, Lot_ID, COM_BLD_nId这四个参数的声明,很是奇怪。who can tell me why and how to remove them?