Hi. I am using the Self Servicing code and I'm trying to bind a collection to a WinForms standard datagrid using a custom table style to display only the Id from the root entity in the collection plus a name from an entity with a 1:1 relation to the root entity. I cannot get the mapping name right on the related field. Here's my code - what am I doing wrong?
' this is a 1:1 relationship from EmployeeFloatHistory.EmployeeId to SecEmployee.EmployeeId
Dim path As PrefetchPath = New PrefetchPath(CType(EntityType.EmployeeFloatHistoryEntity, Integer))
path.Add(EmployeeFloatHistoryEntity.PrefetchPathSecEmployee)
' i have verified that the prefetch works so that the SecEmployee entity is indeed correctly loaded for each history record
Dim floatHistoryCollection As EmployeeFloatHistoryCollection = New EmployeeFloatHistoryCollection
floatHistoryCollection.GetMulti(Nothing, path)
' this is a standard WinForms grid
grid.DataSource = floatHistoryCollection
Dim mainStyle As New DataGridTableStyle
mainStyle.MappingName = floatHistoryCollection.GetListName(Nothing)
Dim TextCol As DataGridTextBoxColumn
' when the grid displays, this column does show up (property = EmployeeFloatHistoryEntity.EmployeeId)
TextCol = New DataGridTextBoxColumn
TextCol.MappingName = "EmployeeId"
TextCol.HeaderText = "Employee Id"
mainStyle.GridColumnStyles.Add(TextCol)
' when grid displays, this column does not show up (property = EmployeeFloatHistoryEntity.SecEmployee.LastName
' I have also tried other variations (see commented code) trying to get at this property - none worked
TextCol = New DataGridTextBoxColumn
'TextCol.MappingName = "SecEmployee.LastName"
'TextCol.MappingName = "EmployeeFloatHistoryCollection.SecEmployee.LastName"
'TextCol.MappingName = "SecEmployeeEntity.LastName"
TextCol.MappingName = "EmployeeFloatHistoryCollection.SecEmployeeEntity.LastName"
TextCol.HeaderText = "Employee Last Name"
mainStyle.GridColumnStyles.Add(TextCol)
grid.TableStyles.Add(mainStyle)