I have a C# ASP .NET MVC application that uses Crystal reports.
My problem is that when I open for an example two reports in two different tabs, my report data source is bound to the last one opened. So, if I open the first report in one tab, and after that the second, when I try to save the first report, or refresh it, it will use the data source from the second(last one opened). I don't know how to change my code to make it work.
This is my code for creating the report:
public void createRep() { try { bool isValid = true; string repName = HttpContext.Current.Session["repName"].ToString(); int zgradaID = (int)HttpContext.Current.Session["id_zgradePregledStanaraPoZgradi"]; if (string.IsNullOrEmpty(repName)) isValid = false; if (isValid) { int zid = zgradaID; ReportDocument rd = new ReportDocument(); string repPath = Server.MapPath("~/Izvestaji/") + repName; rd.Load(repPath); Izvestaji.IzvestajiRep irep = new Izvestaji.IzvestajiRep(); rd.SetDataSource(irep.PregledPoStanaruDS(zgradaID)); CrystalReportViewer1.ReportSource = rd; this.CrystalReportViewer1.ReuseParameterValuesOnRefresh = true; } else { Response.Write("<h2>Izvestaj nije pronadjen!</h2>"); } } catch (Exception ex) { Response.Write(ex.ToString()); } }