Hi I have a report with 2 data sources, and creating a new blank report, I need to delete existing data sources
for this command to call the method sig. when I select new report
void StiDesigner_CreatedReport(object sender, EventArgs e)
{
StiDataSourcesCollection sCollect = new StiDataSourcesCollection(new StiDictionary());
foreach (StiDataSource source in report.Dictionary.DataSources)
{
if (!source.Name.Contains("reporte"))
sCollect.Add(source);
}
report.Dictionary.DataSources = sCollect;
}
but I only open a blank layout but the sources did not delete them
I hope I can explain how pls
trouble removing data sources
trouble removing data sources
Hello,
Please try to use the following code:
Thank you.
Please try to use the following code:
Code: Select all
void GlobalEvents_CreatingReportInDesigner(object sender, StiCreatingObjectEventArgs e)
{
StiReport report = ((StiDesignerControl)sender).Report;
StiDataSourcesCollection sCollect = new StiDataSourcesCollection(new StiDictionary());
foreach (StiDataSource source in report.Dictionary.DataSources)
{
if (!source.Name.Contains("Categories"))
sCollect.Add(source);
}
report.Dictionary.DataSources = sCollect;
e.Processed = false;
}