Posted 13 January 2018, 2:33 am EST
i’m using flexreport to display data from a datatable that gets it data from a SQL Server, then i pass the datatable as a record set to the flexreport.
Now the Layout of the report is working fine. However the data itself is not loaded into the Detail section. i tried many many things and nothing works, the Detail Section never loads.
would you please tell me what am i doing wrong?
Here is my Code using VB.NET:
With C1FlexReport1
.DataSource.RecordSourceType = FlexReport.RecordSourceType.Auto
' clear any existing fields
.Clear()
' set default font for all controls
.Font.Name = "Tahoma"
.Font.Size = 8
'initialize DataSources
Dim ds As Data.DataSet = getDataSet()
.DataSource.Recordset = ds.Tables(0)
'initialize Layout
Dim objLayout As FlexReport.Layout
objLayout = C1FlexReport1.Layout
With objLayout
.Orientation = FlexReport.OrientationEnum.Portrait
.Width = 6.5 * 1440 ' 8.5 - margins, In twips
End With
'Create a Page header
Dim objSectionPageHeader As FlexReport.Section
objSectionPageHeader = C1FlexReport1.Sections(FlexReport.SectionTypeEnum.PageHeader)
With objSectionPageHeader
.Height = 500
.Visible = True
End With
'Add Fields To PageHeader
Dim textFld4 As New FlexReport.TextField
With textFld4
.Name = "LblID"
.Text = "Workspace ID"
.Left = 0 : .Top = 50: .Width = 1400 : .Height = 300
.Align = FlexReport.FieldAlignEnum.RightTop
End With
'Add the field to the appropriate section
.Sections.PageHeader.Fields.Add(textFld4)
'Create the Details Section
Dim objSectionDetails As FlexReport.Section
objSectionDetails = C1FlexReport1.Sections(FlexReport.SectionTypeEnum.Detail)
With objSectionPageHeader
.Height = 330
.Visible = True
End With
'Add Fields To Details
Dim textFld5 As New FlexReport.TextField
With textFld5
.Name = "FldID"
.Text.Expression = "Workspace_PK"
.Left = 0 : .Top = 50
.Width = 1400 : .Height = 300
.Visible = True
End With
'Add the field to the appropriate section
.Sections.Detail.Fields.Add(textFld5)
''RENDER THE REPORT
.Render()
Thanks in advance