I've created a number of business entities for an applciation I'm working on
in ASP.NET (Framework 1.1) and would like to quickly get data into a
BoundColumn for a control that consums a collection. Generally speaking,
when a databound control consums a collection, one simply sets the property
name of the collection members when setting the DataField property of the
BoundColum, as below:
<asp:BoundColumn Visible="False" DataField="ObjId"
HeaderText="id"></asp:BoundColumn>
So in the example above, the DataField "ObjId" is a property of a collection
member, we'll call "ObjectA" (i.e. ObjectA.ObjId").
Now consider we want to do the same thing, but that one of ObjectA's
properties is another object called ObjectB (i.e. ObjectA.ObjectB) which has
its own properties. Just to make things interesting, we'll say that ObjectA
and ObjectB inherit from the same parent class, and that ObjId is an abstract
integer property of that parent class. Thus ObjId is a property of both
ObjectA and ObjectB, and still that ObjectA has ObjectB as one of its
properties.
So as above, we want to refer to ObjectB.ObjId in our BoundColumn, but
unfortunately the collection being consumed is a collection of ObjectA's and
every time I try to refer to any of the properties of ObjectB (i.e.
ObjectA.ObjectB.ObjId) I get an exception being cast.
The question, then is - what syntax would I use in the .aspx file, within
the BoundColumn tag's DataField proeprty to set that property to retrieve
data from ObjectA.ObjectB.ObjId?
Very gratefully,
--
Ross Holder
Ottawa, ON (Canada)
http://spaces.msn.com/members/ross613