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

|||

Thanks lot Tamer Fathy you are nice and simply guide to me

It is working fine once again Thanks lot

regards

kumar

|||

Mr. Tamer,

How do I pass 2 or more parameters to Report ??

Thanks,

Kusno

|||

You welcomeSmile,

you can easily do this as the report parameters are list

ReportParameter(ReportParameterName, Value);

I.e.

string strTime = System.DateTime.Now.ToShortTimeString();

RptParameters[0] =
new Microsoft.Reporting.WebForms.ReportParameter("ReportParameterName",Value);
RptParameters[1]=
new Microsoft.Reporting.WebForms.ReportParameter("ReportParameterName",Value);

 
and so on 

|||

Yes, it works....Yes

Thanks a lot man.

No comments:

Post a Comment