Snap to property
I have a binding List (Of MyObject)
to a GridView on an event Page_Load
. MyObject
It has a child object as a property, ChildObject
which also has a property 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 named "ChildObject.ChildProperty" was not found in the selected data source.
How do I bind this property, or is it not possible? I suppose I could create a ReadOnly property on the parent's read-only child property, but that is a little smelly.
Any ideas?
Thank!
source to share