ObjectDataSource non-primitive data fields

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
 
B

Brock Allen

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.
 
M

Manuel Baumann

Thank you very much for your answer.
This is a clever approach and I will use it.
Thanks again.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top