manni
manni

Reputation: 717

ObjectDataSource 'odsX' could not find a non-generic method 'methodX' that has no parameters

i have an object datasource that is referring to an method with a optional parameter. i get this error when i load the page

"ObjectDataSource 'odsX' could not find a non-generic method 'methodX' that has no parameters."

this is the method signature

[DataObjectMethod(DataObjectMethodType.Select)]
    public static xCollection methodX(bool defaulValue = false)

this is the objectdatasource connected to a gridview in a page

<asp:ObjectDataSource ID="odsX" runat="server" TypeName="XXX"
        SelectMethod="methodX" 
        OnSelected="odsX_Selected"
        DeleteMethod="Delete">
        <DeleteParameters>
            <asp:Parameter Name="xId" Type="Int32" />
        </DeleteParameters>
    </asp:ObjectDataSource>

why doesn't objectdatasource work with optional parameters? help?

thanks!!

Upvotes: 0

Views: 800

Answers (1)

dhinesh
dhinesh

Reputation: 4764

    [DataObjectMethod(DataObjectMethodType.Select)]
    public static xCollection methodY()
    {
      methodX();
    }

Then use methodY in the aspx.

Upvotes: 0

Related Questions