Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

DataGrids and Subproperties

If I have an object (A) with properties that are other objects (B, C) can I databind so that properties of B and C appear in the grid?

An array of A objects is the DataSource.

I try:

<asp:BoundColumn DataField="B.Property1" ...

but I get:

"A field or property with the name 'B.Property1' was not found on the selected datasource."

Any ideas?  Am I attempting the impossible?

Thanks,

Tom

Thomas David Baker
Tuesday, January 13, 2004

I'm pretty sure what you're attempting isn't possible.

If you control "A", you could expose delegate propertes on A for properties on B and C. Not very convenient or pretty, but functional.

Brad Wilson (dotnetguy.techieswithcats.com)
Tuesday, January 13, 2004

I came to the same conclusion and wrote a wrapper class that takes an 'A' in the constructor and exposes the properties required.

Thanks.

Thomas David Baker
Wednesday, January 14, 2004

*  Recent Topics

*  Fog Creek Home