locked
ObjectDataSource 'ObjectDataSource' could not find a non-generic method 'MyMethod' that has parameters: myParameter. RRS feed

  • Question

  • User-1178453918 posted

    How am I supposed to declare my SelectMethod and Parameter? No matter what I try, I get the error "ObjectDataSource 'ObjectDataSource' could not find a non-generic method 'MyMethod' that has parameters: myParameter.". Here's my code as of right now:

    <asp:ObjectDataSource ID="ObjectDataSource" runat="server" SelectMethod="Third.Party.Library.MyMethod" TypeName="Third.Party.Library.SomeObject">
        <SelectParameters>
            <asp:Parameter Name="myParameter" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

    public static SomeObject MyMethod(string myParameter)
    {
        // Code here
    }

    Thursday, September 1, 2011 9:03 PM

Answers

  • User3866881 posted

    Hello Faize,

    I mean that since you can call the method inside the proj, but it can never be found by ObjectDataSource...

    Way 1——Re-compile the whole proj, and re-refer the dll and try again.

    Way 2——Create another cs file, where you can refer and call the dll method, and for the objectDataSource, plz use your own method instead. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 3, 2011 8:54 PM

All replies

  • User-417784260 posted

    Is the class public?

    Thursday, September 1, 2011 9:11 PM
  • User-1178453918 posted

    Yes, the class is public. I have no problems accessing and databinding to the method from the codebehind.

    Friday, September 2, 2011 2:46 PM
  • User3866881 posted

    Hello Faize,

    I mean that since you can call the method inside the proj, but it can never be found by ObjectDataSource...

    Way 1——Re-compile the whole proj, and re-refer the dll and try again.

    Way 2——Create another cs file, where you can refer and call the dll method, and for the objectDataSource, plz use your own method instead. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 3, 2011 8:54 PM