Monday, January 31, 2011

Setting Values To RDLC Report



/***********************************************************************
Description:Following proceduce explains setting the values to controls such as textboxes in a RDLC report file. This code is compiled in C#, VS2010.
Step 1 : Create a parameter using Report Data window from Visual Studio 2010 (View -> Report Data)
Step 2 : Attach created parameter to a textbox in rdlc report (in design view)
Step 3 : Use the following code example

***********************************************************************/




ReportViewer repViewer = new ReportViewer();
repViewer.ProcessingMode = ProcessingMode.Local;
repViewer.LocalReport.ReportPath = @"YourReport.rdlc";
List par = new List();
ReportParameter p = new ReportParameter("Name","Your Name");
par.Add(p);
p = new ReportParameter("Address", "Hyderabad, India");
par.Add(p);
p = new ReportParameter("SrNo", "1000");
par.Add(p);
repViewer.LocalReport.SetParameters(par);