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);




4 comments:

  1. hi,
    i use this code but i am getting error on
    repViewer.LocalReport.SetParameters(par);
    i am using asp.net 4.0

    ReplyDelete
  2. Tìm hiểu xem có nên làm ở công ty tnhh đầu tư Quốc tế Hoàn Mỹ hay không tại https://quoctehoanmy.com/

    ReplyDelete