or
| public partial class MyReportViewer : Window |
| { |
| private IReportDocument myReport; |
| public MyReportViewer(IReportDocument document) |
| { |
| myReport = document; |
| InitializeComponent(); |
| } |
| private void WindowLoaded(object sender, RoutedEventArgs e) |
| { |
| System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); |
| ReportViewer rptViewer = new ReportViewer(); |
| rptViewer.Report = this.myReport; |
| rptViewer.RefreshReport(); |
| host.Child = rptViewer; |
| } |
| } |
| KeyFront keyfront = new KeyFront(zone.ZoneID); |
| MyReportViewer rptViewer = new MyReportViewer(keyfront); |
| rptViewer.Show(); |
Here's the report code:
| public KeyFront(int zonepk) |
| { |
| /// <summary> |
| /// Required for telerik Reporting designer support |
| /// </summary> |
| InitializeComponent(); |
| this.sqlDataAdapter1.SelectCommand.Parameters["@ZonePK"].Value = zonepk; |
| this.DataSource = this.sqlDataAdapter1; |
| // |
| // TODO: Add any constructor code after InitializeComponent call |
| // |
| } |
The report viewer window does appear but is blank. What am I missing?
Thanks,
-Sid Meyers.
SqlConnection connSomsys = new SqlConnection(@"Server=cmdivst004\Jason08;Integrated Security=true;Database=QuoteDB");
SqlCommand selectChartinfo;
selectChartinfo =
new SqlCommand("sprocgetinternationalsales", connSomsys);
selectChartinfo.CommandType =
CommandType.StoredProcedure;
selectChartinfo.Parameters.AddWithValue(
"@year", 2008);
SqlDataAdapter adapter6 = new SqlDataAdapter(selectChartinfo);
DataSet dataSet6 = new DataSet();
adapter6.Fill(dataSet6);
this.chart1.datasource = dataSet6;
| namespace AWS_Reports |
| { |
| using System; |
| using System.ComponentModel; |
| using System.Drawing; |
| using System.Windows.Forms; |
| using System.Configuration; |
| using Telerik.Reporting; |
| using Telerik.Reporting.Drawing; |
| /// <summary> |
| /// Summary description for MyAccountEstimator. |
| /// </summary> |
| public partial class MyAccountEstimatorStats : Telerik.Reporting.Report |
| { |
| public MyAccountEstimatorStats() |
| { |
| /// <summary> |
| /// Required for telerik Reporting designer support |
| /// </summary> |
| InitializeComponent(); |
| // Remove the design time data source to force use of NeedDataSource event |
| this.DataSource = null; |
| lstSummary.DataSource = null; |
| } |
| private void MyAccountEstimatorStats_NeedDataSource(object sender, EventArgs e) |
| { |
| // Try to get connection string from config file |
| ConnectionStringSettings cnStr = cnStrSettings(); |
| if ((cnStr != null) && (cnStr.ConnectionString != null)) |
| { |
| this.dsEstimatorUsageDetailsTableAdapter1.Connection.ConnectionString = cnStrSettings().ConnectionString; |
| } |
| try |
| { |
| this.dsEstimatorUsageDetailsTableAdapter1.Fill(this.dsEstimatorUsage.dsEstimatorUsageDetailsTable, StartDate, EndDate); |
| this.DataSource = this.dsEstimatorUsage; |
| this.DataMember = "dsEstimatorUsageDetailsTable"; |
| } |
| catch (System.Exception ex) |
| { |
| // An error has occurred while filling the data set. Please check the exception for more information. |
| System.Diagnostics.Debug.WriteLine(ex.Message); |
| } |
| } |
| private void lstSummary_NeedDataSource(object sender, EventArgs e) |
| { |
| // Try to get connection string from config file |
| ConnectionStringSettings cnStr = cnStrSettings(); |
| if ((cnStr != null) && (cnStr.ConnectionString != null)) |
| { |
| this.prWEP_MyAccountUsageTotalsTableAdapter1.Connection.ConnectionString = cnStrSettings().ConnectionString; |
| } |
| try |
| { |
| this.prWEP_MyAccountUsageTotalsTableAdapter1.Fill(this.dsEstimatorUsage.prWEP_MyAccountUsageTotals, StartDate, EndDate); |
| this.lstSummary.DataSource = this.dsEstimatorUsage; |
| this.lstSummary.DataMember = "prWEP_MyAccountUsageTotals"; |
| } |
| catch (System.Exception ex) |
| { |
| // An error has occurred while filling the data set. Please check the exception for more information. |
| System.Diagnostics.Debug.WriteLine(ex.Message); |
| } |
| } |
| private ConnectionStringSettings cnStrSettings() |
| { |
| // Get connection string from web.config |
| ConnectionStringSettings connStrSettings = ConfigurationManager.ConnectionStrings["AnchorWallConnectionString"]; |
| return connStrSettings; |
| } |
| public DateTime StartDate |
| { |
| get { return DateTime.Parse(this.ReportParameters["StartDate"].Value.ToString()); } |
| set { this.ReportParameters["StartDate"].Value = value; } |
| } |
| public DateTime EndDate |
| { |
| get { return DateTime.Parse(this.ReportParameters["EndDate"].Value.ToString()); } |
| set { this.ReportParameters["EndDate"].Value = value; } |
| } |
| } |
| } |
| reportBook = new ReportBook(); |
| for (int i = 0; i < regionList.Count; i++) |
| { |
| RegionReport regionReport = new RegionReport(); |
| regionReport.ReportParameters["RegionId"].Value = regionList[j]; |
| reportBook.Reports.Add(regionReport); |
| for (int j = 0; j < areaList.Count; j++) |
| { |
| AreaReport areaReport = new AreaReport(); |
| areaReport.ReportParameters["AreaId"].Value = areaList[j]; |
| reportBook.Reports.Add(areaReport); |
| } |
| } |
| private void RegionReport_NeedDataSource(object sender, EventArgs e) |
| { |
| Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender; |
| //If I had two RegionReport reports added to the book, RegionId parameter's value would be always of the last one added. |
| int param = Convert.ToInt16(this.ReportParameters["RegionId"].Value); |
| ... |