About Me

My photo
Software Developer and ideas man!

Tuesday, June 7, 2011

Ever wanted to turn off the drill down capability on subreports.

Here are 2 simple ways of turning off the drilldown capability on a subreport. In the code below, I've performed the cast to expose other methods and properties of the args parameter [the cast is unnecessary though].


private void CRViewer_DrillDownSubreport(object source, CrystalDecisions.Windows.Forms.DrillSubreportEventArgs e)
        {
            (e as CrystalDecisions.Windows.Forms.ViewerEventArgs).Handled = true;
        }

Note -  this code can be useful if you wanted to enable or disable the drilldown for a particular subreport.



The drilling down in the CR viewer can also be turned off by setting "EnableDrilldown" to false in the properties of the viewer which is less flexible given it is in place for all reports.



More from this Blogger:
Localizing Crystal Reports in C# - I demonstrate one way of doing it despite the hurdles!

1 comment: