views:

51

answers:

1

How do I get the ASP.NET Controls for Crystal Reports in Visual Studio 2008? I've downloaded and installed a lot of things, but the guidance on the SAP website isn't very helpful to me.

What do I need to download and install on my machine to create an ASP.NET application which surfaces Crystal Reports?

+1  A: 

I think Crystal Report is intergated with VS long time ago.Even there is a Reporting Tab that is shown in Toolbox.How to use it well,Simple Add Crystal Report file to your project from Add item option and follow the wizard.

How to bind it to your web site is also simple.Add Crystal report View control from toolbox to the your web form.Then do

    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument document = CreateReportDocument("MyReportFile");              
        CrystalReportViewer1.ReportSource = document;
    }

    public static ReportDocument CreateReportDocument(string crystalReportName)
    {
        ReportDocument crdocument = new ReportDocument();  // Report document variable 
        string reportfile = ConfigurationManager.AppSettings["CrystalReportFilePath"].ToString() + "\\" + crystalReportName + ".rpt";            
        try
        {                
                DataTable report = new Datatable(); // You should put your data here
                crdocument.Load(reportfile);// Load the report being displayed
                crdocument.Database.Tables[0].SetDataSource(report);           
        }
        catch (Exception exception)
        {
            throw exception;
        }
        return crdocument;
    }
Wonde
I don't see any Crystal Reports Tab in the Toolbox, and neither is it in the Add New Item Dialog for the project..
Ryan Shripat
There's a reporting tab that includes the Microsoft report viewer as well. For me, it's between AJAX extensions and HTML.
Steve
@Steve.Thank for correcting me.I should say it in Reporting Tab.And @Ryan Shripat, as long as I know they integrated since I know VS 2003.
Wonde