private void ReportViewer1_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e) { // When a Drillthrough event occurs, cancel it and assign the drillthrough report's URL and path // to the viewer in the popup panel, then display the popup panel. e.Cancel = true; ReportViewerDrillthrough.ServerReport.ReportServerUrl = ((ServerReport)e.Report).ReportServerUrl; ReportViewerDrillthrough.ServerReport.ReportPath = ((ServerReport)e.Report).ReportPath; ModalPopupExtender_Drillthrough.Show(); }
void ReportViewer1_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e) { DataSet ds = new DataSet(); ds = (DataSet)Session["dsProductInventory"]; LocalReport InventoryReport = (LocalReport)e.Report; InventoryReport.DataSources.Add(new ReportDataSource("dsProductInventory_dtInventoryStatus", ds.Tables[0])); }
protected void rptViewer_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e) { SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connString"].ToString()); conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "uspRptDetailByOrigin"; cmd.CommandType = CommandType.StoredProcedure; if (Session["profilename"].ToString() == "Client") { cmd.Parameters.Add(new SqlParameter("@ClientId", Session["ClientId"].ToString())); } else { cmd.Parameters.Add(new SqlParameter("@ClientId", this.lstClient.SelectedValue.ToString())); } Microsoft.Reporting.WebForms.ReportParameterInfoCollection DrillThroughValues = e.Report.GetParameters(); cmd.Parameters.Add(new SqlParameter("@Src", DrillThroughValues[0].Values[0])); SqlDataReader dr = cmd.ExecuteReader(); dsInvoiceDetail ds = new dsInvoiceDetail(); while (dr.Read()) { ds.Tables[0].Rows.Add(dr[0].ToString(), System.Convert.ToDateTime(dr[1].ToString()), dr[2].ToString(), dr[3].ToString(), System.Convert.ToInt32(dr[4].ToString()), System.Convert.ToDouble(dr[5].ToString())); } dr.Close(); conn.Close(); conn.Dispose(); this.rptViewer.LocalReport.DataSources.Clear(); this.rptViewer.Reset(); LocalReport drillThroughReport = (LocalReport)e.Report; Microsoft.Reporting.WebForms.ReportDataSource rdInvDetail = new Microsoft.Reporting.WebForms.ReportDataSource("dsInvoiceDetailwhatever", ds.Tables[0]); drillThroughReport.DataSources.Add(rdInvDetail); this.rptViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; this.rptViewer.LocalReport.ReportPath = @"Reports\StatementDetailBySrc.rdlc"; Microsoft.Reporting.WebForms.ReportParameter Origin = new Microsoft.Reporting.WebForms.ReportParameter("Origin", DrillThroughValues[0].Values[0]); this.rptViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { Origin }); this.rptViewer.LocalReport.Refresh(); }
// drill through protected void ReportViewer_Drillthrough(object sender, MsDrillthroughEventArgs e) { if (ScriptManager.GetCurrent(this.Page) != null && ScriptManager.GetCurrent(this.Page).EnableHistory) { ScriptManager.GetCurrent(this.Page).AddHistoryPoint("reportname", e.Report.DisplayName); } if (DrillThrough != null) { DrillThrough(this, e); } // find the drill-through report from the library string configurationFilename = ConfigurationManager.AppSettings["VB.Reports.App.ReportDefinitionLibrary.Xml.Serialization.ReportMetadata.Path"]; ReportFactory factory = ReportFactory.NewReportFactory(configurationFilename); IReport report = factory.FindReportByServerPath(e.ReportPath); // bind the data source if (e.Report is MsLocalReport) { BindLocalReport((MsLocalReport)e.Report, report); } else { BindServerReport((MsServerReport)e.Report, report); } // update the report parameter section to be hidden from view ReportParameterOptions.Visible = false; ReportParameterSubmit.Visible = false; // show the back to parent report button ReportParameterBack.Visible = true; ReportParameterBackText.Text = "Back to " + TheReport().Name; }