3
調用鑽取報告中,我有一個RDLC報告名稱attendence.rdlc這需要三個參數僱員,monthId和年產生員工的月出勤status.Like 在RDLC
當我點擊>>按鈕類似於:
我需要調用鑽取(在我的情況下是相同的報告)報告增加月份和年份的參數。
如何創建鑽取甚至處理程序RDLC報告?
調用鑽取報告中,我有一個RDLC報告名稱attendence.rdlc這需要三個參數僱員,monthId和年產生員工的月出勤status.Like 在RDLC
當我點擊>>按鈕類似於:
我需要調用鑽取(在我的情況下是相同的報告)報告增加月份和年份的參數。
如何創建鑽取甚至處理程序RDLC報告?
我的問題已經solved.In RDLC當有人叫goto_report/goto_url..it實際上是通過鑽取report.So稱爲如果我創建吶,甚至處理明顯回傳URL外部像
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//otherscode u need
//now call report first time
string path = HttpContext.Current.Server.MapPath(your report path);
ReportViewer1.Reset(); //important
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.EnableHyperlinks = true;
LocalReport objReport = ReportViewer1.LocalReport;
objReport.DataSources.Clear();
objReport.ReportPath = path;
// Add Parameter if you need
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("parameterName", ParameterValue));
ReportViewer1.LocalReport.SetParameters(parameters);
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ShowPromptAreaButton = false;
ReportViewer1.LocalReport.Refresh();
//Add Datasourdce
ReportDataSource reportDataSource = new ReportDataSource();
reportDataSource.Name = "odsReportData";
reportDataSource.Value = YourReportDataSourseValue;
objReport.DataSources.Add(reportDataSource);
objReport.Refresh();
}
ReportViewer1.Drillthrough += new DrillthroughEventHandler(DemoDrillthroughEventHandler);
}
public void DemoDrillthroughEventHandler(object sender, DrillthroughEventArgs e)
{
/*Collect report parameter from drillthrough report*/
ReportParameterInfoCollection DrillThroughValues = e.Report.GetParameters();
Type parameterName = Type.Parse(DrillThroughValues[1].Values[0].ToString());
/*Bind data source with report*/
LocalReport localReport = (LocalReport)e.Report;
localReport.DataSources.Clear();
localReport.DataSources.Add(new ReportDataSource("odsData", reportData));
localReport.EnableHyperlinks = true;
/*Add parameter to the report if report have paramerter*/
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("ParameterName", ParameterValue));
localReport.SetParameters(parameters);
localReport.Refresh();
}