I am new to ASP.NET and I am trying to implement a native ObjectDataSource insertion method. The default business method works fine (with one object parameter). However, when I add an additional parameter, the business method is not called.
Here is my code - Insert () is always called, but InsertWithParams () never does.
public class MyObject
{
public MyObject() {}
public string Foo { get; set;}
}
namespace MyLogic {
public static Insert(MyObject m)
{
}
public static InsertWithParams(MyObject m, string p)
{
}
}
Given the following ObjectDataSource declaration, InsertWithParams and MyObjectDS_Inserting are never called.
However, if "MyLogic.Insert" is specified instead, it raises a call along with the event. Also, if I remove the p parameter from InsertWithParams, it will be called.
<asp:ObjectDataSource runat="server" ID="MyObjectDS"
TypeName="Business.MyLogic"
DataObjectTypeName="Business.MyObject"
InsertMethod="InsertWithParams"
OnInserting="MyObjectDS_Inserting"
>
<InsertParameters>
<asp:Parameter Name="m" Type="Object" />
<asp:Parameter Name="p" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
, insert ObjectDataSource.
InsertParameters, , .