Tuesday, 10 January 2012

working with local reports rdlc files from a dataset

created a local reports (rdlc) - which takes heading as a parameters.
data also comes dynamically through a datatable.
 
DataTable dtPrint = (DataTable)Session["Table"];  // data to be bound can be from session or viewstate
string rptHeading = Request.QueryString["heading"];   // heading
rpvPrint.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
rpvPrint.LocalReport.ReportPath = Page.MapPath(".") +  "\\Report.rdlc";
ReportParameter[] rp =new ReportParameter[1];
rp[0] = new ReportParameter("Heading", rptHeading);
rpvPrint.LocalReport.SetParameters(rp);  
ReportDataSource rds1 = new ReportDataSource("PrintData", dtPrint);
rpvPrint.LocalReport.DataSources.Clear();   
rpvPrint.LocalReport.DataSources.Add(rds1);
rpvPrint.LocalReport.Refresh();

No comments:

Post a Comment