Hello,
I am dynamically adding sub reports to my detail section. Here is my code
For an example we have 2 records in me.datasource. I have verified within the databound event that only 2 subreports are in the detail section. But When I set a break point in the sub report I see it is executed 4 times. If there are 3 records it is executed 6 times etc. I have tried adding to the footer section but got the same result.
It is important to note that my sub report has 9 sub reports in it. From what I have read online, I assume this is ok
Let me know if I am doing something wrong.
Thanks
Dave B
I am dynamically adding sub reports to my detail section. Here is my code
Private
Sub
MasterReport_ItemDataBinding(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.ItemDataBinding
Dim
unitX
As
Drawing.Unit = Drawing.Unit.Inch(0)
Dim
unitY
As
Drawing.Unit = Drawing.Unit.Inch(0)
Dim
size
As
New
Drawing.SizeU(Drawing.Unit.Inch(0.01), Drawing.Unit.Inch(0.01))
Dim
ds
As
DataSet = TryCast(
Me
.DataSource, DataSet)
Dim
index
As
Integer
= 0
Me
.DetailSection1.Items.Clear()
For
Each
dr
As
DataRow
In
ds.Tables(0).Rows
Dim
d
As
New
MyData()
'internal object that executes spocs
Dim
subReport
As
New
Telerik.Reporting.SubReport
Dim
rpt
As
New
NameOfSubReport
subReport.ReportSource = rpt
d.StoredProc =
"StoredProcedureName"
d.Parameters.Add(
"@PersonID"
, SqlDbType.Int).Value = dr(
"PersonID"
)
subReport.ReportSource.DataSource = d.ExecuteStoredProcToDataset
subReport.Location =
New
Drawing.PointU(unitX, unitY)
subReport.Size = size
Me
.DetailSection1.Items.Add(subReport)
unitY = unitY.Add(Drawing.Unit.Inch(0.1))
Next
End
Sub
For an example we have 2 records in me.datasource. I have verified within the databound event that only 2 subreports are in the detail section. But When I set a break point in the sub report I see it is executed 4 times. If there are 3 records it is executed 6 times etc. I have tried adding to the footer section but got the same result.
It is important to note that my sub report has 9 sub reports in it. From what I have read online, I assume this is ok
Let me know if I am doing something wrong.
Thanks
Dave B