yeasir007

Monday, October 15, 2012

Bind data coming from dataset to header in rdlc reports


Bind data coming from dataset to header in rdlc reports:


First Create Parameter in rdlc report:

Now Add Parameter from .cs file:
// Add Parameter 
            List<ReportParameter> parameters = new List<ReportParameter>();
            parameters.Add(new ReportParameter("AccountName", accountName));
            parameters.Add(new ReportParameter("AccountCode", "Account Code: " + accountCode));
            parameters.Add(new ReportParameter("UnitName", unitName.ToUpper()));
            parameters.Add(new ReportParameter("UnitAddress", unitAddress.ToUpper()));
            parameters.Add(new ReportParameter("Title", "Schedule"));
            parameters.Add(new ReportParameter("Date", dateVal));
            ReportViewer1.LocalReport.SetParameters(parameters);
            ReportViewer1.ShowParameterPrompts = false;
            ReportViewer1.ShowPromptAreaButton = false;
            ReportViewer1.LocalReport.Refresh();
Note : Para meter name both rdlc and .cs file must be same

No comments:

Post a Comment

Thanks for your comments