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

So I’ve got an ObjectDataSource with its SelectMethod set to ‘GetStuffById’ and the contract is GetStuffById(int stuffId) and the error in the title comes up.

I’m thinking ‘what the…of course it’s got parameters read the flamin’ contract!. I even had a beautiful FormParameter defined in the markup.

But I left something out. Yes, I left out the parameter NAME.
That’s why there’s a single blank space in the error message between ‘parameters:’ and ‘.’ where the list of parameter names goes.


My markup said:

asp:ObjectDataSource ID=”stuffDataSource” runat=”server” DataObjectTypeName=”StuffDto”
SelectMethod=”GetStuffByStuffId” TypeName=”StuffService” >
asp:FormParameter DefaultValue=”1″ /

Notice the FormParameter does not have a Name attribute? Yeah. Well I didn’t until about five minutes ago.

It should have read:
asp:FormParameter Name=”stuffId” DefaultValue=”1″

And yes, I’m eating my liver.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: