Home All Groups Group Topic Archive Search About

ObjectDataSource ... could not find a non-generic method ... that has parameters: ...

Author
19 Mar 2006 12:50 PM
uri.goldstein
Hello,

My problem is in ASP.Net 2.0. I have a GridView that is bound to an
ObjectDataSource. The ObjectDataSource works against a "business" class
(referenced in a separate assembly) containing static methods for
selecting, updating and deleting business objects.

My problem is that I keep getting an InvalidOperationException when
trying to update a row. The exception says:

    "ObjectDataSource 'odsRetentionGroups' could not find a non-generic
method 'SetRetentionGroup' that has parameters: ID, Name, Description."

This happens despite the fact that the "business" class mentioned
before has the following method:

        public static void SetRetentionGroup(string ID, string Name,
string Description)
        { ... }

Can anyone help solve this problem? I am giving the relevant bits of
code below:

<asp:ObjectDataSource ID="odsRetentionGroups" runat="server"
    TypeName="LBO_PLL.RetentionHandler"
    SelectMethod="GetRetentionGroupsAndRetentions"
    UpdateMethod="SetRetentionGroup">
</asp:ObjectDataSource>

<asp:GridView ID="grdRetentionGroups" runat="server"
    DataSourceID="odsRetentionGroups"
    DataKeyNames="ID" EnableViewState="true" >
....
</asp:GridView>


Thanks in advance,
Uri Goldstein

Author
19 Mar 2006 4:12 PM
CaffieneRush@gmail.com
Check the signature of your business object's update method very
carefully (both the parameter name, parameter type and order) versus
the actual error message.

If the parameter list is still identical in both cases, then debug
furthur by hooking onto your ODS's Inserting event and checking the
ODS's InsertParameters collection.

I suspect is that the ODS has modified the key names by appending the
OldValuesParameterFormatString to the key names before calling the
DataSourceView.
Author
20 Mar 2006 8:32 AM
Uri Goldstein
Hello Andy, thanks for your help.

It turns out that my problem had nothing to do with
OldValuesParameterFormatString. The cause of the problem was an
outdated file reference.

My business object resides in a DLL created by a solution that's
separate from my website solution. When I referenced the DLL from my
website, VS2005 automatically checked it into Visual SourceSafe. This
was at an early stage - before the DLL contained the update method. So
later, when I tried to point the ODS to the newer DLL , reflection was
unable to locate the update method and threw the exception.

Once I've removed and re-added the reference in my web site, the
problem was solved.

Sadly, I still don't know how to make VS2005 handle the reference
"dynamically". I've done some digging and found this -
http://webproject.scottgu.com/ . It's a preview look at a planned "Web
Application" project-type for VS2005 which is planned to enable
"dynamic" references.

Thanks again for your help.

Uri