showing complex business objects in datagrid

  • Thread starter Thread starter Jon Paugh
  • Start date Start date
J

Jon Paugh

So say I have a collection of instances of object A's.

Now each object A has a reference to an object B.

If object A has a property called "Description" I can get
at it in a datagrid bound to my collection of object A's
using:

<%# DataBinder.Eval(Container.DataItem, "Description")%>

but what about if object B has a property called
Description? Is there a way to get at this property on
related object B?

I know I could put some code in the ItemDataBound event
handler for my datagird to do this. I am wondering if
there is a way to do it using databinder, or even better,
using the properties on a BoundColumn.

Thanks,

Jon Paugh
 
but what about if object B has a property called
Description? Is there a way to get at this property on
related object B?

One way to handle this is to add a property to object A that returns
the instance of object B. Then you can do the following (example
assumes that object A has a property named ObjectB):

<%# DataBinder.Eval(Container.DataItem, "ObjectB.Description")%>
 
Yes, I know about this. I am looking for something that
doesn't require me to change my objects every time I want
to look at them.
-----Original Message-----


One way to handle this is to add a property to object A that returns
the instance of object B. Then you can do the following (example
assumes that object A has a property named ObjectB):

<%# DataBinder.Eval
(Container.DataItem, "ObjectB.Description")%>
 
Back
Top