Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
890
How can I determine the datasource of a Band?
posted

Hi All,

If I were to bind a grid to a BindingList(Of MyListItemClass), each column "maps" to a property of MyListItemClass.

During runtime, given a column, I can always get to the underlying MyListItemClass property and its value.

However, if one of the properties of MyListItemClass is a BindingList(Of MyOtherListItemClass), then that property does not map to a column, but maps to a "Band".

During runtime, given a Band, I *cannot* seem get to the underlying MyListItemClass property and its value.

My question is:  given a Band, how do I determine the object it is bound to?

Regards,

Scott Pearce

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi Scott,

    Actually, a band is a column. If you check the parent band's Columns collection, you will find a column that represents the child band.So I think you can do row.Cells["Child Band Name"].Value to get the actual BindingList property on the parent object.

    If I am wrong and that doesn't work, then an alternate way to get it would be to use row.ListObject property. The ListObject returns the row in the underlying data source that the grid row is getting it's data from. So if you have a parent grid row, you can get it's ListObject, cast it into a MyListItemClass, and access the properties of the MyListItemClass directly.

     

Children
No Data