Is it possible to show 3 "Crystal Report" in single "Report Viewer Control" page??
My current code for 1 Crystal Report and 1 Report Viewer control Page is below:
Below code Page name is "JpsCrystalReport.aspx"
using CrystalDecisions.CrystalReports.Engine; //for crystal report
using CrystalDecisions.ReportSource;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("select id,CreationDate,Category,SubCategory,Station,Description,Price from Asset_detail", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "DataTable1");
ReportDocument report = new ReportDocument();
report.Load(Server.MapPath("CrystalReport.rpt"));
report.SetDataSource(ds);
CrystalReportViewer1.ReportSource = report;
//report.SetDatabaseLogon("username", "password", "root", "1234"); //to avoid prompt window for username and password
con.Close();
}
Now I want to include 2 more Crystal Reports in this Viewer control page. So that when I click button (which is in different .aspx page say "abc.aspx") then I should open each Crystal Report as per condition given on Button click (in page "abc.aspx")
Condition on button click is below:
protected void Bshow_Click(object sender, EventArgs e)
{
try
{
if (DReportFilter.SelectedValue == "Asset Detail")
{
filterbyAsset_Date();
InsertbyAsset_Data();
string queryString = "/JpsCrystalReport.aspx";
string jquery = "window.open('" + queryString + "');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", jquery, true);
}
else if (DReportFilter.SelectedValue == "Sluice Gate Station")
{
filterbyBarrage_Date();
string queryString = "/JpsCrystalReport.aspx";
string jquery = "window.open('" + queryString + "');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", jquery, true);
}
else if (DReportFilter.SelectedValue == "Barrage Station")
{
}
}
catch (Exception ex)
{
Response.Write("Exception found!!" + ex);
}
}
I want that when i click on button it redirects to "JpsCrystalReport.aspx" page as per condition given. Then on "JpsCrystalReport.aspx" page it should execute the 3 crystal reports as per conditions given on button click.
Or I had to create 3 different "JpsCrystalReport.aspx" pages (that contains Report Viewer control) to show 3 Different Crystal Reports as per condition on button click?
Please reply how to achieve?