Hi, I create a project with two report's.
One report (the master) contains tabular data and another report (the subreport) with only the Chart.
The problem:
When I run the main report the first time, the tabular data on master report and the chart in subreport shows correctly.
But if I change the parameters on the mater report, only a data in a master report is correctly refresh. The chart of subreport stay with first values. I try copy the Chart to master report without success.
I use a Chart with NeedDatasource event.
My Business with Dataset for Report and Chart Datasource
public static class BusinessParameters |
{ |
public static ReportParameter DataInicial { get; set; } |
public static ReportParameter DataFinal { get; set; } |
public static Datasets.DSEnvioRepresentante DSEnvioRepresentante { get; set; } |
|
public static Boolean ParamsOK() |
{ |
return (DataInicial != null) && |
(DataFinal != null) && |
(DataInicial.Value != null) && |
(DataFinal.Value != null) && |
(!String.IsNullOrEmpty(DataInicial.Value.ToString())) && |
(!String.IsNullOrEmpty(DataFinal.Value.ToString())); |
} |
} |
My Report with Chart (without subreport)
/// <summary> |
/// Summary description for EnvioPorRepresentanteA. |
/// </summary> |
/// |
[Description("Envios por Representantes")] |
public partial class EnvioPorRepresentante : DCReport |
{ |
public EnvioPorRepresentante() |
{ |
/// <summary> |
/// Required for telerik Reporting designer support |
/// </summary> |
InitializeComponent(); |
|
// |
// TODO: Add any constructor code after InitializeComponent call |
// |
this.Visivel = true; |
BLL.BusinessParameters.DSEnvioRepresentante = new DocumentCenter.Reports.Datasets.DSEnvioRepresentante(); |
} |
private void BindData() |
{ |
BLL.BusinessParameters.DataInicial = this.ReportParameters[0]; |
BLL.BusinessParameters.DataFinal = this.ReportParameters[1]; |
if (BLL.BusinessParameters.ParamsOK()) |
{ |
|
Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter taEnvioRepresentante = new DocumentCenter.Reports.Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter(); |
taEnvioRepresentante.ClearBeforeFill = true; |
taEnvioRepresentante.FillByData(BLL.BusinessParameters.DSEnvioRepresentante.EnviosPorRepresentante, Convert.ToDateTime(BLL.BusinessParameters.DataInicial.Value), Convert.ToDateTime(BLL.BusinessParameters.DataFinal.Value)); |
} |
else |
{ |
Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter taEnvioRepresentante = new DocumentCenter.Reports.Datasets.DSEnvioRepresentanteTableAdapters.EnviosPorRepresentanteTableAdapter(); |
taEnvioRepresentante.ClearBeforeFill = true; |
taEnvioRepresentante.Fill(BLL.BusinessParameters.DSEnvioRepresentante.EnviosPorRepresentante); |
} |
} |
private void EnvioPorRepresentante_NeedDataSource_1(object sender, System.EventArgs e) |
{ |
BindData(); |
(sender as Telerik.Reporting.Processing.Report).DataSource = BLL.BusinessParameters.DSEnvioRepresentante; |
(sender as Telerik.Reporting.Processing.Report).DataMember = "EnviosPorRepresentante"; |
} |
|
private void chart1_NeedDataSource(object sender, EventArgs e) |
{ |
Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart; |
chart.DataSource = BLL.BusinessParameters.DSEnvioRepresentante.EnviosPorRepresentante; |
} |
} |