Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to combine 2 different datasets passed through sessions data?
I want to show that as button into a single crystal report, how?

I have grid1 and grid2 showing data on buttonclick and in the same way I need to show this in crystal report.
Posted
Updated 24-Nov-10 23:04pm
v2
Comments
Manfred Rudolf Bihy 24-Nov-10 10:50am    
I had no idea that meth comes in flavors. ;-)
Dalek Dave 25-Nov-10 5:04am    
Edited for Readability.

1 solution

You can store the 2 datasets in 2 sessions & check then assign to report, That's all.
C#
protected void BtnGenerateReport_Click(object sender, EventArgs e)
{
    ReportDocument myReportDocument = new ReportDocument();
    myReportDocument.Load(Server.MapPath("\\test.rpt");

    if(Session["DataSet1"] != null)
        {
            DataSet rptDs1 = (DataSet)Session["DataSet1"];
            myReportDocument.SetDataSource(rptDs1);
        }
        else if (Session["DataSet2"] != null)
        {
            DataSet rptDs2 = (DataSet)Session["DataSet2"];
            myReportDocument.SetDataSource(rptDs2);
        }
        CrystalReportViewer1.ReportSource = myReportDocument;
        CrystalReportViewer1.DataBind();
        CrystalReportViewer1.EnableDrillDown = true;
}
I hope it will resolve your issue.
 
Share this answer
 
Comments
Dalek Dave 25-Nov-10 5:04am    
Good 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