I am trying to pass a parameter to my data source, but it isn't passing the correct value. How does my code look below? Is there a way to debug and use breakpoints when building report classes?
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; } |
} |
} |
} |