Search code examples
visual-studiocrystal-reports

Creating A button on my Webform to open up my CrystalReportViewer


I've just started coding(im using visual studio 2012 right now) and one of my task right now is to open up the crystalreportviewer from a webform onclick a button, I have created the webform/db/crystalreport but i just dont know how to open up the crystalreportviewer on my browser and as well as linking it to the button onclick.

I have went through many tutorials/videos/blogs but still do not understand how to solve it.

Any help would be greatly appreciated.


Solution

  • protected void Button1_Click(object sender, EventArgs e)
    
        {
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load("YOURCRYSTALREPORTFILE");
            CrystalReportViewer1.ReportSource = cryRpt;
    
    
        }
    

    i have figured out how to create a button and onclick it would open up the crystal report by loading