or
public
static
string
ExportToPdf(
string
documentName,
int
periodId,
int
pupilId)
{
ReportProcessor reportProcessor =
new
ReportProcessor();
Hashtable deviceInfo =
new
Hashtable();
InstanceReportSource instanceReportSource =
new
InstanceReportSource ();
instanceReportSource.ReportDocument=
new
ARView2();
instanceReportSource.ReportDocument.DocumentName = documentName;
instanceReportSource.Parameters.Add(
new
Telerik.Reporting.Parameter(
"PeriodID"
, periodId));
instanceReportSource.Parameters.Add(
new
Telerik.Reporting.Parameter(
"PupilID"
, pupilId));
RenderingResult result = reportProcessor.RenderReport(
"PDF"
, instanceReportSource, deviceInfo);
string
fileName = result.DocumentName +
"."
+ result.Extension;
string
filePath = Path.Combine(Path.GetTempPath(), fileName);
using
(FileStream fs =
new
FileStream(filePath, FileMode.Create))
{
fs.Write(result.DocumentBytes,0,result.DocumentBytes.Length);
}
return
filePath;
}
if
(e.Item.Level == 0)
return
;
string
[] parms = e.Item.Value.Split(
':'
);
int
periodId = Convert.ToInt32(parms[0]);
int
pupilId = Convert.ToInt32(parms[1]);
var rpt =
new
ARView2
{
DocumentName =
string
.Format(
"{0} {1} {2}"
,cbPermittedPupils.Text.Trim().Replace(
","
,
""
),
pbARList.SelectedItem.Text.Trim(),
((RadPanelItem)pbARList.SelectedItem.Parent).Text)
};
rvAR.ReportSource =
new
InstanceReportSource { ReportDocument = rpt };
rvAR.ReportSource.Parameters.Add(
new
Parameter(
"PeriodID"
, periodId));
rvAR.ReportSource.Parameters.Add(
new
Parameter(
"PupilID"
, pupilId));
rvAR.RefreshReport();
How can I pass the datasource to a subreport from a page?
Ex: "ReportViewer1.Report.SubReport.DataSource = ds"
[]'s
Henrique