0
votes

I am trying to set the datasource for my crystal reports from a dataset. This is what I have so far:

 protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            ds = util.getReportDataSet(DateTime.Now.AddYears(-5), DateTime.Now);
            CrystalDecisions.Web.Report report = new CrystalDecisions.Web.Report();          
            //CrystalDecisions.Web.CrystalReportSource source = new CrystalDecisions.Web.CrystalReportSource();
           // source.Report = report;

            report.FileName = @"MyReport.rpt";

            crs1.Report = report;
            CrystalReportViewer1.ReportSource = crs1;            
        }

html:

 <form id="form1" runat="server">
    <div>
        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />

        <CR:CrystalReportSource ID="crs1" runat="server" />
    </div>
    </form>

When the CrystalReportViewer1.ReportSource = crs1; execytes, I am getting this error:

Microsoft JScript runtime error: 'bobj' is undefined

Any idea what's wrong? I am using .net framework 3.5. Thanks in advance, Laziale

UPDATE:

Running the page in Chrome doesn't show that error, but also I am getting blank page although the dataset has data.

1
What is <CR in reference to crs1 are you missing some code or some instantiating somewhere..? - MethodMan
@DJKRAZE thats the crystal reports namespace, default from what I downloaded from their official website. - Laziale

1 Answers

0
votes

View source on the page, and copy (or if using FF, click) the reference to the Crystal JS file.You will probably find that the path to the crystalwebviewer component is not accessible from your page.

Ok I pulled out an old project to check. In view source, you will see a script reference like this:

<script src="../../aspnet_client/system_web/2_0_50727/crystalreportviewers12/js/crviewer/crv.js" type="text/javascript"></script>

And you need to make sure that your page can access this url to get the Crystal client-side script or else the viewer will not work. Typical causes of this are incorrect permissions on the source folder or the crystalreportviewers12 not being a proper IIS application, both of these issues caused me a lot of grief....