How to prevent Sub Report click event
I'm using a subreport as a report header. I've discovered that the user can click on the subreport and it appears to disable the tool bar. I realized that it's actually drilling into the subreport and that the name of the subreport is displayed in the tool bar. Is there anyway to prevent the user from drilling down while still displaying the content? I tried Suppress, but that just hides the report.
Trevor Dubinsky replied
There is actually no way to stop the drill down in the subreport with in the report itself. However thereare two solutions:
A - From the design of the report.
If the subreport is not dynamically sized, IE you know the max size it will be then you can:
1 - create a blank formula in the main report.
2 - Size the subreport to the largest it will be
3 - Insert the formula in the same section as the subreport just above the subreport.
4 - Size the formula to be slightly bigger then the subreport
Now as the formula is blank and it sits above the subreport (layer wise) any clicks will go to it and not to the subreport.
B - From code:
The .NET viewer control has a DrillDownSubreport event. Open this even and set the handled property to true, this will tell the viewer that you are handling the drill-down so it has to do nothing. The code will look like this:
(In C# that is, and similar in VB .NET)
private void CrystalReportViewer1_DrillDownSubreport(object source, CrystalDecisions.Web.DrillSubreportEventArgs e)
e.Handled = true