Sunday, February 19, 2012

Integrating Rdl to webapplication with parameter passing

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

No comments:

Post a Comment