Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi how can i provide the report source to a single report viewer dynamically?...ie if checkbox a is selceted report for a is shown in reportviewer if b is selected report for b is shown in same reportviewer
thank u
Arpan
Posted

Fro this you need to put a code in show report button click event like this....

C#
 protected void btnShowReport_Click(object sender, EventArgs e)
{
    if (A.Checked == true)
    {
        ReportDocument rpt = new ReportDocument();
        rpt.Load("CrystalReport1.rpt");
        CRPTViewer.ReportSource = rpt;
        CRPTViewer.RefreshReport();
    }
    if (B.Checked == true)
    {
        ReportDocument rpt = new ReportDocument();
        rpt.Load("CrystalReport2.rpt");
        CRPTViewer.ReportSource = rpt;
        CRPTViewer.RefreshReport();
    }
}
 
Share this answer
 
Comments
amsainju 5-Nov-11 7:41am    
thank you for your help
Tejas Vaishnav 5-Nov-11 8:09am    
Your Welcome...
Use this :
C#
protected void btnShowReport_Click(object sender, EventArgs e)
{
    ReportDocument rpt = new ReportDocument();
    if (A.Checked == true)
    {
        rpt.Load("CrystalReport1.rpt");
    }
    else
    {
        rpt.Load("CrystalReport2.rpt");
    }
    CRPTViewer.ReportSource = rpt;
    CRPTViewer.RefreshReport();
}


It will save your time and gives speed

-Thanks.
 
Share this answer
 
Comments
amsainju 5-Nov-11 7:41am    
thank u for your help.

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