Databinding Question

  • Thread starter Thread starter Big Dave
  • Start date Start date
B

Big Dave

Good morning. I am trying to bind a datagrid to a custom business
object. One of the properties is another object, but I can't seem to
bind to that. Here is an example:

Public Class Company
Private _companyName as string
Public Property CompanyName as string
Get
Return _companyName
End Get
Set(Value as string)
_companyName = Value
End Set

Private _parentCompany as Company
Public Property ParentCompany as Company
Get
Return ParentCompany
End Get
Set(Value as Company)
_parentCompany = Value
End Set
End Class

I have a collection class that holds companies. I can bind a datagrid
to the collections CompanyName property, but not the the
ParentCompany.CompanyName property. Does anyone have any thoughts on
how to do that?

Thanks for your help.

Big Dave
 
<%# DataBinder.Eval(Container.DataItem, "ParentCompany.CompanyName") %>

or

<%# ctype(Container.DataItem, Company).ParentCompany.CompanyName %>


Karl
 
Back
Top