I just converted my Telerik reports to Q3 2012 and they all work except for two reports that have subreports. The NeedDataSource event is not firing for the subreports. Here is the code. What am I doing wrong? Thanks.
My report .aspx:
CPR_Reports.SalesActivityReport report1 = new CPR_Reports.SalesActivityReport(myConnectionstring, Convert.ToInt32(Session["pk"].ToString()), Convert.ToInt32(Session["cpruser_no"].ToString()), fromdate, todate);
InstanceReportSource instanceReportSource = new InstanceReportSource();
instanceReportSource.ReportDocument = report1;
this.ReportViewer1.ReportSource = instanceReportSource;
My report class:
public partial class SalesActivityReport : Telerik.Reporting.Report
{
public SalesActivityReport(string myConnectionstring, int cfkwebuser, int cfkpnnames, string fromdate, string todate)
{
localConnectionstring = myConnectionstring;
localCfkWebUser = cfkwebuser;
localCfkPnnames = cfkpnnames;
localFromDate = fromdate;
localToDate = todate;
InitializeComponent(reportHeaderBgColor, reportHeaderTextColor);
SalesActivitySub1 salesActivitySub1 = new SalesActivitySub1();
SubReport subReport1 = new Telerik.Reporting.SubReport();
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = salesActivitySub1;
subReport1.ReportSource = instanceReportSource;
subReport1.NeedDataSource += new EventHandler(subReport1_NeedDataSource);
private void subReport1_NeedDataSource(object sender, EventArgs e)
{
EventLogger log1 = new EventLogger();
string commandText = @"exec wa_SalesActivityCallsLogged2 " + localCfkPnnames + ",'" + localFromDate + "','" + localToDate + " 23:59:59'";
try
{
SqlConnection sqlConnection1 = new SqlConnection();
SqlCommand sqlSelectCommand1 = new SqlCommand();
SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter();
sqlConnection1.ConnectionString = localConnectionstring;
sqlSelectCommand1.CommandText = commandText;
sqlSelectCommand1.Connection = sqlConnection1;
sqlDataAdapter1.SelectCommand = sqlSelectCommand1;
this.DataSource = sqlDataAdapter1;
}
catch (Exception ex)
{
log1.WriteError(ex);
}
finally
{
log1.Dispose();
}
}
}