B
Bryce
I have an ObjectDataSource binding a GridView, with Delete enabled. The
following is the declaration (with non-delete stuff left out to save space):
<asp:ObjectDataSource ID="CatalogItemsListDataSource"
runat="server" DeleteMethod="DeleteCatalogItem"
InsertMethod="InsertCatalogItem"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetCatalogItemsList"
TypeName="CatalogItemManager" UpdateMethod="UpdateCatalogItem">
<DeleteParameters>
<asparameter Name="id" Type="Int32" />
</DeleteParameters>
....
</asp:ObjectDataSource>
So I've got a class that has the following function:
[DataObjectMethodAttribute
(DataObjectMethodType.Delete, false)]
public int DeleteCatalogItem(int id)
{
return CatalogAdapter.DeleteItemQuery(id);
}
when it runs, it gives me the following error:
[InvalidOperationException: ObjectDataSource 'CatalogItemsListDataSource'
could not find a non-generic method 'DeleteCatalogItem' that has parameters:
id, original_Id.]
which seems odd, because I selected the delete method above with a single
parameter during the ObjectDataSource configuration wizard.
So I created another method with two parameters that works:
[DataObjectMethodAttribute
(DataObjectMethodType.Delete, false)]
public int DeleteCatalogItem(int id, int original_Id)
{
return DeleteCatalogItem(original_Id);
}
Which is fine, but I'm curious why it expects two parameters when I selected
the method that has one (and the DeleteParameters shows that I only wanted
one paramter).
Thanks
following is the declaration (with non-delete stuff left out to save space):
<asp:ObjectDataSource ID="CatalogItemsListDataSource"
runat="server" DeleteMethod="DeleteCatalogItem"
InsertMethod="InsertCatalogItem"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetCatalogItemsList"
TypeName="CatalogItemManager" UpdateMethod="UpdateCatalogItem">
<DeleteParameters>
<asparameter Name="id" Type="Int32" />
</DeleteParameters>
....
</asp:ObjectDataSource>
So I've got a class that has the following function:
[DataObjectMethodAttribute
(DataObjectMethodType.Delete, false)]
public int DeleteCatalogItem(int id)
{
return CatalogAdapter.DeleteItemQuery(id);
}
when it runs, it gives me the following error:
[InvalidOperationException: ObjectDataSource 'CatalogItemsListDataSource'
could not find a non-generic method 'DeleteCatalogItem' that has parameters:
id, original_Id.]
which seems odd, because I selected the delete method above with a single
parameter during the ObjectDataSource configuration wizard.
So I created another method with two parameters that works:
[DataObjectMethodAttribute
(DataObjectMethodType.Delete, false)]
public int DeleteCatalogItem(int id, int original_Id)
{
return DeleteCatalogItem(original_Id);
}
Which is fine, but I'm curious why it expects two parameters when I selected
the method that has one (and the DeleteParameters shows that I only wanted
one paramter).
Thanks