//ReportData is a userdefined function DataTable reportdt=ReportData(); ReportDataSource dsrpt = new ReportDataSource(); dsrpt.Name = "Datasetpagename_NameofdatatableinDatasetpagename"; dsrpt.Value = reportdt; string s1; s1 = reportdt.Rows[0]["C1"].ToString(); // s2 = dt.Rows[0]["C2"].ToString(); try { if (dsrpt != null) { ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/_LAYOUTS/15/SampleReport/SampleReport1.rdlc"); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.Visible = true; ReportViewer1.LocalReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("SampleReportDataSet", reportdt)); Microsoft.Reporting.WebForms.ReportParameter[] reportParameterCollection = new Microsoft.Reporting.WebForms.ReportParameter[1]; reportParameterCollection[0] = new Microsoft.Reporting.WebForms.ReportParameter(); reportParameterCollection[0].Name = "ProjectName"; reportParameterCollection[0].Values.Add(s1 == null ? "" : s1); reportParameterCollection[0].Visible = false; ReportViewer1.AsyncRendering = false; ReportViewer1.SizeToReportContent = true; ReportViewer1.LocalReport.Refresh(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)