ObjectDataSource non-primitive data fields

  • Thread starter Thread starter DoesDotNet
  • Start date Start date
D

DoesDotNet

HI All

I have a class called program with a class called Investor as one of
its Properties.

Now, I wish I could do this:
<asp:BoundField DataField="Investor.Name" HeaderText="Investor"
SortExpression="Investor.Name" />

but it won't let me...

A field or property with the name 'Investor.Name' was not found on the
selected data source.

What's the common way to do this?
Thank you in advance
 
The ObjectDataSource needs to map those directly to a parameter to the method
or to a property on the object type. So in short, it doesn't support that
style. You could write a InvestorName property on the class which in turn
sets the Investor.Name.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Thank you very much for your answer.
This is a clever approach and I will use it.
Thanks again.
 
Back
Top