ObjectDatasource

  • Thread starter motorhead_maniac
  • Start date
M

motorhead_maniac

hi All,

Iam having a objectdatasource control declared in the markup as


<asp:ObjectDataSource ID="odsProperties" runat="server"
TypeName="System.Collections.IEnumerable"
SelectMethod="GetProperties"></asp:ObjectDataSource>


Then on the code behind iam hacing a method declated like ...

public IEnumerable GetProperties()
{

return New ArrayList();
}


but i still get the following error

ObjectDataSource 'odsProperties' could not find a non-generic method
'GetProperties' that has no parameters.


Am i missing something ?, this is very basic and should work :)

regards
 
O

Onwuka Emeka

Your typename should be the name of the class where the method is defined in
e.g
public class MyClass{
public IEnumerable GetProperties()
{
return New ArrayList();
}
}

so your ObjectDataSource should be

<asp:ObjectDataSource ID="odsProperties" runat="server"
TypeName="MyClass" SelectMethod="GetProperties"></asp:ObjectDataSource>

Your previous construct would insinuate that "GetProperties" was a method in
the System.Collections.IEnumerable class
 
M

motorhead_maniac

Onwuka,
thanks for the reply, i can see clearly now :) , iam wondering if i can
specify the control class name itself somehow :)

regards
 

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,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top