Evento ReportViewer.Drillthrough
Viene generato quando si seleziona un elemento drill-through.
Spazio dei nomi: Microsoft.Reporting.WebForms
Assembly: Microsoft.ReportViewer.WebForms (in microsoft.reportviewer.webforms.dll)
Sintassi
'Dichiarazione
<SRDescriptionAttribute("DrillthroughEventDesc")> _
Public Event Drillthrough As DrillthroughEventHandler
'Utilizzo
Dim instance As ReportViewer
Dim handler As DrillthroughEventHandler
AddHandler instance.Drillthrough, handler
[SRDescriptionAttribute("DrillthroughEventDesc")]
public event DrillthroughEventHandler Drillthrough
public:
event DrillthroughEventHandler^ Drillthrough {
void add (DrillthroughEventHandler^ value);
void remove (DrillthroughEventHandler^ value);
}
/** @event */
public void add_Drillthrough (DrillthroughEventHandler value)
/** @event */
public void remove_Drillthrough (DrillthroughEventHandler value)
JScript supports the use of events, but not the declaration of new ones.
Note
Questo evento viene generato quando si seleziona un elemento drill-through. Le informazioni sull'evento vengono passate in un oggetto DrillThroughEventArgs al delegato DrillThroughEventHandler, che gestisce l'evento.
Per ulteriori informazioni sulla gestione degli eventi, vedere Consuming Events.
Esempio
Nell'esempio di codice seguente viene caricato un report di esempio che contiene una serie di elementi drill-through e viene impostato un gestore dell'evento per la gestione degli eventi di drill-through. Gli argomenti passati al gestore dell'evento di drill-through includono un oggetto report drill-through. Il gestore dell'evento aggiunge un'origine dei dati a questo report prima che venga eseguito il rendering del report drill-through nel controllo ReportViewer.
Imports System.DataImports Microsoft.Reporting.WebFormsPartial Class _Default Inherits System.Web.UI.Page Private Function LoadEmployeesData() As DataTable Dim dataSet As New DataSet() dataSet.ReadXml("c:\My Reports\employees.xml") LoadEmployeesData = dataSet.Tables(0) End Function Private Function LoadDepartmentsData() Dim dataSet As New DataSet() dataSet.ReadXml("c:\My Reports\departments.xml") LoadDepartmentsData = dataSet.Tables(0) End Function Public Sub DemoDrillthroughEventHandler(ByVal sender As Object, ByVal e As DrillthroughEventArgs) Dim localReport = e.Report localReport.DataSources.Add(New ReportDataSource("Employees", LoadEmployeesData())) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If (Not IsPostBack) Then ' Set RDL file. ReportViewer1.LocalReport.ReportPath = "c:\My Reports\Departments.rdlc" ' Supply a DataTable corresponding to each report data source. Dim myReportDataSource = New ReportDataSource("Departments", LoadDepartmentsData()) ReportViewer1.LocalReport.DataSources.Add(myReportDataSource) End If 'Add a handler for drillthrough. AddHandler ReportViewer1.Drillthrough, AddressOf DemoDrillthroughEventHandler End SubEnd Class
using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Microsoft.Reporting.WebForms;public partial class _Default : System.Web.UI.Page { private DataTable LoadEmployeesData() { DataSet dataSet = new DataSet(); dataSet.ReadXml(@"c:\My Reports\employees.xml"); return dataSet.Tables[0]; } private DataTable LoadDepartmentsData() { DataSet dataSet = new DataSet(); dataSet.ReadXml(@"c:\My Reports\departments.xml"); return dataSet.Tables[0]; } void DemoDrillthroughEventHandler(object sender, DrillthroughEventArgs e) { LocalReport localReport = (LocalReport)e.Report; localReport.DataSources.Add(new ReportDataSource("Employees", LoadEmployeesData())); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // On initial page load ReportViewer1.LocalReport.ReportPath = @"c:\My Reports\Departments.rdlc"; // Supply a DataTable corresponding to each report data source. ReportViewer1.LocalReport.DataSources.Add( new ReportDataSource("Departments", LoadDepartmentsData())); } // Add the handler for drillthrough. ReportViewer1.Drillthrough += new DrillthroughEventHandler(DemoDrillthroughEventHandler); }}
Vedere anche
Riferimento
Classe ReportViewer
Membri ReportViewer
Spazio dei nomi Microsoft.Reporting.WebForms