Click here to Skip to main content
16,017,634 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to view "Report Viewer" using a button click event ? Reprot is working in a form load event ..but when i trying to view Report viewer using button click event it is not working ..can any one tell me the code for that one
Posted
Comments
kishorekke 11-Oct-11 8:30am    
can u show ur code?

1 solution

try:
C#
protected void btn_generatereport_onclick(object sender, EventArgs e)
   {



SQL
DataObjectDataSource1.SelectParameters["xyz"].DefaultValue = "xxx";
           DataObjectDataSource1.SelectParameters["abc"].DefaultValue ="xxx";


SQL
ReportParameter[] reportParameters = new ReportParameter[8];
           reportParameters[0] = new ReportParameter("xyzName","xxx");
           reportParameters[1] = new ReportParameter("abcName","xxx";


C#
ReportViewer1.LocalReport.SetParameters(reportParameters);
            ReportViewer1.DataBind();
            ReportViewer1.LocalReport.Refresh();

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900