Click here to Skip to main content
15,889,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I have tried to using of report viewer 2010 but when I pass the parameter and run the application it fall in a loop and doesn't show anything, my application was in .net 3.5 but when I convert that to 4.0 this issue happened, I tried to create a new rdlc and use of report viewer 2010 but no result,
this is my cs code :
C#
protected void Page_Load(object sender, EventArgs e)
       {

           object exCarId = HttpContext.Current.Session[Constants.ExCarID];
           if (exCarId != null)
           {
               string select = string.Format("Select * from ExCar where Id = {0} ", exCarId);
               DataRow datarow = xps.GetDataRow(select);
               if (datarow != null)
               {
                   //    string Herasat = File.ReadAllText(Server.MapPath("~/App_Data/Herasat.txt"));
                   //    string ModirKol = File.ReadAllText(Server.MapPath("~/App_Data/ModirKol.txt"));

                   List<reportparameter> list = new List<reportparameter>();


                   list.Add(new ReportParameter("p1", Convert.ToString(datarow["CarNum"])));
                   list.Add(new ReportParameter("p2", Convert.ToString(datarow["CarType"])));
                   list.Add(new ReportParameter("p3", Convert.ToString(datarow["ShasiNum"])));
                   list.Add(new ReportParameter("p4", Convert.ToString(datarow["OwnerType"])));
                   list.Add(new ReportParameter("p5", Convert.ToString(datarow["MotorNum"])));
                   list.Add(new ReportParameter("p6", Convert.ToString(datarow["SerialNum"])));



                   ReportParameter[] reportParameters = list.ToArray();

                   rptViewer.LocalReport.SetParameters(reportParameters);
                   rptViewer.LocalReport.EnableExternalImages = true;
                   //rptViewer.LocalReport.EnableExternalImages = true;
                   rptViewer.LocalReport.Refresh();
                   rptViewer.DataBind();
               }
           }
       }


thanks in advanced!
Posted
Updated 4-Feb-12 19:17pm
v2

Maybe Refresh causes a Page_Load and at the end of Page_Load, Refresh causes a Page_Load again and this is going to continue for ever.
 
Share this answer
 
v2
Comments
Maral Azizi 5-Feb-12 1:24am    
No before that i tried this without using rptViewer.LocalReport.Refresh();
but still its in loop.
I just Add this
C#
if (!IsPostBack)
           {
             //
           }


and i found that the issue was because of postback!
 
Share this answer
 

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