I have a List (Of MyObject)
binding to a GridView in the Page_Load
event. MyObject
has a child object as a property, ChildObject
which also has a property itself, ChildProperty
.
In my GridView, I would like to bind one of the fields to ChildProperty
, but doing something like:
<asp:boundfield datafield="ChildObject.ChildProperty" />
results in an error:
System.Web.HttpException: A field or property with the name 'ChildObject.ChildProperty' was not found on the selected data source.
How do I bind to that property, or is it not possible? I suppose I could create a ReadOnly property in my parent object just to read the child property, but that's a bit smelly.
Any ideas?
Thanks!