Sunday, September 20, 2009

Hide and Show Crystal Report’s Sub Report when we need

Refer to my previous post assume you want to display the sub report only data is available. therefore you can check the data for row availability and if rows are exists you can  display the report. In my example we are placed our sub report in section 4 in main report. thus we can use following code to display the sub report only data is available.

if (dts.Rows.Count > 0)
{
Ci.Subreports["SubBalance"].SetDataSource((DataTable)dts);
}
else
{
Ci.ReportDefinition.Sections[3].SectionFormat.EnableSuppress = true;
}
Post a Comment