or
<
UserControl.Resources
>
<
ControlTemplate
x:Key
=
"ReportViewerControlTemplate1"
TargetType
=
"rv:ReportViewer"
/>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
rv:ReportViewer
Template
=
"{StaticResource ReportViewerControlTemplate1}"
/>
</
Grid
>
<
body
leftmargin
=
"0"
topmargin
=
"0"
marginheight
=
"0"
marginwidth
=
"0"
style
=
"margin: 0px;"
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
style
=
"height: 100%;"
>
<
telerik:ReportViewer
ID
=
"ReportViewer1"
runat
=
"server"
width
=
"100%"
height
=
"100%"
>
</
telerik:ReportViewer
>
</
div
>
</
form
>
</
body
>
01.
protected
void
Page_Load(
object
sender, EventArgs e)
02.
{
03.
if
(!IsPostBack)
04.
{
05.
LoadData();
06.
}
07.
}
08.
09.
private
void
LoadData()
10.
{
11.
Page.Title =
"Report Title"
;
12.
13.
ReportBook reportBook =
new
ReportBook();
14.
15.
CustomReport1 report =
new
CustomReport1();
16.
CustomReport2 report2 =
new
CustomReport2();
17.
CustomReportData data =
new
CustomReportData(_Id);
18.
report.DataSource = data;
19.
report2.DataSource = data;
20.
21.
reportBook.Reports.Add(report);
22.
reportBook.Reports.Add(report2);
23.
24.
this
.ReportViewer1.Report = reportBook;
25.
}
01.
public
partial
class
CustomReport : Telerik.Reporting.Report
02.
{
03.
public
CustomReport()
04.
{
05.
/// <summary>
06.
/// Required for telerik Reporting designer support
07.
/// </summary>
08.
InitializeComponent();
09.
10.
//create event that will set the data source for the table
11.
tbl.NeedDataSource +=
new
EventHandler(tbl_NeedDataSource);
12.
}
13.
14.
/// <summary>
15.
/// Handles the NeedDataSource event of the tbl control.
16.
/// </summary>
17.
/// <param name="sender">The source of the event.</param>
18.
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
19.
void
tbl_NeedDataSource(
object
sender, EventArgs e)
20.
{
21.
//In order to programmatically set the table, we need to use the processing table
22.
Telerik.Reporting.Processing.Table table = ((Telerik.Reporting.Processing.Table)sender);
23.
24.
//set the data source of the table
25.
table.DataSource = ((CustomReportData)table.Report.DataSource).CustomCollection;
26.
}
27.
}
I am using the needdatasource event on the subreport to get data:
Private Sub TimesheetParityBreakdownReport_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.NeedDataSource
the parameters are being passed to the subreport are stuck on the first row data values from the mainreport.
ie I have a 100 different rows in the main report and the subreport comes out eveytime based on rows 1 values.
i need each subreport to be based on the each detail items of the main report
I also need to know how to run the subreport ondemand, so that it automatically doesnt call the subreport 100 times for example.
I have various field on the main report which i can use to show subreport. I'd like it so when i click to open one subreport, any open ones should close.
using Q2 2010 reporting
Thanks