could not find a non-generic method

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>
<asp:parameter 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top