Share via


Exposing Drill-Down Event Report Data to the Label Control

This section shows you how to add text to the Label control to indicate which part of the report the user has drilled down on.

To expose drill-down event report data to the Label control

  1. From the View menu, click Code to view the code-behind class for this Web Form.

  2. Locate the following code that handles the drill-down event:

    Protected Sub myCrystalReportViewer_Drill(ByVal source As Object,
    ByVal e As CrystalDecisions.Web.DrillEventArgs) Handles
    myCrystalReportViewer.Drill
    
    End Sub
    
    protected void crystalReportViewer_Drill(object source,
    CrystalDecisions.Web.DrillEventArgs e)
    {
    
    }
    
  3. To display the name of the drilled down report part on the Label control, add the following line of code in the event handler method:

    drillLabel.Text = e.NewGroupName
    
    drillLabel.Text = e.NewGroupName;
    
  4. From the File menu, click Save All.

To build and run the project

You are now ready to build and run the project.

  1. From the Build menu, click Build Solution.

  2. If you have any build errors, fix them now.

  3. From the Debug menu, click Start.

If no build errors appear, the project loads into your Web browser and displays the Web Form, with the World Sales Report generated on the form.
  1. To test that the label displays the drill-down event report data correctly, under the Top 5 Countries' Sales heading, click on USA to drill down on this part of the report. The page reloads and the USA sales report displays, "USA".

  2. Return to Visual Studio, and then click Stop to exit from debug mode.