problem with cystal report sub reports
My crystal report should be dispalyed like this
startdate enddate ....etc
--------------------------------------------------------------------------- main reports -detail section
01/01/1999 01/01/2000 ... etc
---------------------------------------------- sub report
// based on the above startdate and enddate you need to display some columns here...
----------------------------------------------
---------------------------------------------------------------------------
I have written a code to get the dataset to bind the sub report .i.e., in the code behind window.. i need to fetch these startdate and enddate value in each row.. so that I can get the data set for the sub report.
The code taht i have written for the sub report binding is pated here below, please kindly let me know what I should do?
Dim crSections As Sections = oRD.ReportDefinition.Sections
Dim crReportObjects As ReportObjects
Dim crSubreportObject As SubreportObject
Dim crSubReportDoc As ReportDocument
Dim subReportCount As Integer = 0For Each crSection As Section In crSections
crReportObjects = crSection.ReportObjects
'loop through all the report objects to find all the subreports
For Each crReportObject As ReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then
'you will need to typecast the reportobject to a subreport
'object once you find it
subReportCount += 1
crSubreportObject = DirectCast(crReportObject, SubreportObject)
'open the subreport object
crSubReportDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)
'Once the correct subreport has been located pass it the
'appropriate dataset
Dim oGettrainingdata As New ETT_BO.BO_ETT_GETTRAININGDATA
crSection.ReportObjects.Item("Startdate1").ObjectF ormat.EnableSuppress = True
crSection.ReportObjects.Item("Enddate1").ObjectFor mat.EnableSuppress = True 'crSection.ReportObjects("startdate1").ObjectForma t.ToString
Dim startdate As String = "1/1/2008" '.................................................. ...here i am unable to figure it out how to fecth the mainreports field values.
oGettrainingdata.StartDate = startdate
oGettrainingdata.EndDate = "1/31/2008" 'crSection.ReportObjects("enddate1").ToString
Dim ds1 As DataSet = oGettrainingdata.ETT_GETTRAININGDATA_GetDataset(1)
crSubReportDoc.SetDataSource(ds1)
End If
Next
Next
|