Friday, March 30, 2012

ReportViewer Help

I use the following code to display a report in the ReportViewer. The report
and the shared datasource are in another .NET solution. The report displays,
but the data does not. Can anyone help me figure out how to make the
report data display?
private DataTable LoadReportData()
{
DataSet ds = new DataSet();
ds.ReadXml("C:\\Reports\\ReportsSharedDataSource.rds");
return ds.Tables[1];
}
protected void Page_Load(object sender, EventArgs e)
{
this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.
ProcessingMode.Local;
this.ReportViewer1.LocalReport.ReportPath = "C:\\Reports\\ActivitySummaryReport.rdl";
this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.
Reporting.WebForms.ReportDataSource("ReportsSharedDataSource",
LoadReportData()));
this.ReportViewer1.LocalReport.EnableExternalImages = true;
}
Thanks,
PaulaAssuming that Tables[1] actually returns data and your report bindings are
correct, try:
reportViewer1.RefreshReport()
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Paula" <pmpayne@.nospam.com> wrote in message
news:abc40aa6399943198835be4ccb90828a@.ureader.com...
>I use the following code to display a report in the ReportViewer. The
>report
> and the shared datasource are in another .NET solution. The report
> displays,
> but the data does not. Can anyone help me figure out how to make the
> report data display?
> private DataTable LoadReportData()
> {
> DataSet ds = new DataSet();
> ds.ReadXml("C:\\Reports\\ReportsSharedDataSource.rds");
> return ds.Tables[1];
> }
> protected void Page_Load(object sender, EventArgs e)
> {
> this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.
> ProcessingMode.Local;
> this.ReportViewer1.LocalReport.ReportPath => "C:\\Reports\\ActivitySummaryReport.rdl";
> this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.
> Reporting.WebForms.ReportDataSource("ReportsSharedDataSource",
> LoadReportData()));
> this.ReportViewer1.LocalReport.EnableExternalImages = true;
> }
> Thanks,
> Paula|||How many tables do you have in your dataset?
Remeber that tables are 0 indexed, so if you had only one table in your
dataset you would want to return Tables[0].
"Paula" <pmpayne@.nospam.com> wrote in message
news:abc40aa6399943198835be4ccb90828a@.ureader.com...
>I use the following code to display a report in the ReportViewer. The
>report
> and the shared datasource are in another .NET solution. The report
> displays,
> but the data does not. Can anyone help me figure out how to make the
> report data display?
> private DataTable LoadReportData()
> {
> DataSet ds = new DataSet();
> ds.ReadXml("C:\\Reports\\ReportsSharedDataSource.rds");
> return ds.Tables[1];
> }
> protected void Page_Load(object sender, EventArgs e)
> {
> this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.
> ProcessingMode.Local;
> this.ReportViewer1.LocalReport.ReportPath => "C:\\Reports\\ActivitySummaryReport.rdl";
> this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.
> Reporting.WebForms.ReportDataSource("ReportsSharedDataSource",
> LoadReportData()));
> this.ReportViewer1.LocalReport.EnableExternalImages = true;
> }
> Thanks,
> Paulasql

No comments:

Post a Comment