GridView DataBinding to an Object Hierarchy

  • Thread starter Thread starter Jay Pondy
  • Start date Start date
J

Jay Pondy

Given the following List(of Position) objects for an ObjectDataSource

Position
Description
EmployeeA
FirstName
LastName
EmployeeB
FirstName
LastName

Is it possible to bind a GridView column to EmployeeA.LastName?
 
Yes. Use a Template Column:

<asp:TemplateField HeaderText="EmployeeA">
<ItemTemplate>
<%#eval("EmployeeA.LastName") %>
</ItemTemplate>
/asp:TemplateField>
 
Back
Top