Click here to Skip to main content
15,903,388 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
ReferenceError: bobj is not defined
this is the error when i am accessing crystal report based application which is deployed on iis server
while i was working on local host i was getting same error then i have placed "C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13" thse scripting files and folders in my projects solution's explorer then problem got resolved but now i have deployed same application on iis from another machine and there also i have made same setting means i have placed same(aspnet_client\system_web\4_0_30319\crystalreportviewers13") scripting files in my projects root folder but its not working and report is still blank on browser and when i am doing inspect element via browser then i am getting the ReferenceError: bobj is not defined

html is as belw

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="CRM_And_Quotation_System.WebForm2" %>

<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>

<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
<script src="/crystalreportviewers13/js/crviewer/crv.js" type="test/javascript" ></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <br />
&nbsp;<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Generate PDF" />
        &nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send Mail" />
    
        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1202px" ReportSourceID="CrystalReportSource1" ToolbarImagesFolderUrl="" ToolPanelWidth="200px" Width="1104px" OnInit="CrystalReportViewer1_Init2" />
        <asp:Label ID="lbl_QuotationId" runat="server" Visible="False"></asp:Label>
        <br />
    
        &nbsp;&nbsp;&nbsp;
        <br />
    </div>
    
    </form>
</body>
</html>


and this is the code behind page

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using CrystalDecisions;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.IO;

namespace CRM_And_Quotation_System
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        string CS = ConfigurationManager.ConnectionStrings["MyConnectionSQLServer"].ConnectionString;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["QuotationId"] != null)
            { 
                    int QuotationId = Convert.ToInt32(Session["QuotationId"]);            
                    lbl_QuotationId.Text = QuotationId.ToString();          
                    CrystalReportViewer1.Visible = true;
                    SqlConnection connection = new SqlConnection(CS);
                    SqlConnection connection1 = new SqlConnection(CS);
                    connection.Open();
                    SqlCommand command = new SqlCommand("Select QuotationId,Comp_CompanyName,Comp_CompanyCity,Comp_CompanyAddress,comp_Pin,comp_ContactNo,cust_CustomerName,Desccription,Price,Quantity,LineTotal,Country,DeliveryPeriod,Excise,Taxes,Freight,PayementTerms,RexrothPartNo From quotation where QuotationId="+lbl_QuotationId.Text.Trim()+ "", connection);
                    SqlDataAdapter adapter = new SqlDataAdapter(command);
                    FinalQuotation1 dataset = new FinalQuotation1();
                    adapter.Fill(dataset);              
                    ReportDocument Report = new ReportDocument();               Report.Load(Server.MapPath("FinalQuotationReport.rpt"));                 
                    Report.SetDataSource(dataset.Tables[1]);
                    CrystalReportViewer1.ReportSource = Report;              
            }
            else
            {
                string display = "Quotation Id Not Found";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + display + "');", true);
            }
        } 
 protected void Button2_Click(object sender, EventArgs e)
        {
            int QuotationId = Convert.ToInt32(Session["QuotationId"]);
            lbl_QuotationId.Text = QuotationId.ToString();
            CrystalReportViewer1.Visible = true;
            SqlConnection connection = new SqlConnection(CS);
            SqlConnection connection1 = new SqlConnection(CS);
            connection.Open();
            SqlCommand command = new SqlCommand("Select QuotationId,Comp_CompanyName,Comp_CompanyCity,Comp_CompanyAddress,comp_Pin,comp_ContactNo,cust_CustomerName,Desccription,Price,Quantity,LineTotal,Country,DeliveryPeriod,Excise,Taxes,Freight,PayementTerms,RexrothPartNo From quotation where QuotationId=" + lbl_QuotationId.Text.Trim() + "", connection);
            SqlDataAdapter adapter = new SqlDataAdapter(command);
            FinalQuotation1 dataset = new FinalQuotation1();
            adapter.Fill(dataset);
            ReportDocument Report = new ReportDocument();
            Report.Load(Server.MapPath("FinalQuotationReport.rpt"));
            Report.SetDataSource(dataset.Tables[1]);
            CrystalReportViewer1.ReportSource = Report;
            Report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,"IND " + lbl_QuotationId.Text.Trim()+"-FY15-16");          
        }
    }
  }      


how do i overcome this problem???need help
Thanks in advance
Posted
Updated 3-Jan-16 22:09pm
v5
Comments
BillWoodruff 4-Jan-16 2:35am    
How can we help you if we have no idea what 'bobj is ? You need to provide details about your code.
Madhav Gunjal 4-Jan-16 2:51am    
actually the crystal report is not getting displayed on browsr its showing only a blank page,
but when i am doing inspect element by rght clicking on that black page of crystal report then such referenced error is shown and i think this might be happening due to java script which is getting created and executed internally while excecution the application its internal process,there is no any coding error
BillWoodruff 4-Jan-16 3:20am    
Vague details about the context will not help us understand. You need to show the code that is using CrystalReports to produce the report. Post a carefully selected excerpt from the code here that shows where the error that 'bobj is undefined. Add it to your original post, and format it with the CP editor.

1 solution

i get rid of this issue by simply providing javascript file path to crystal report's html page(.aspx) as like

HTML
<script src="/crystalreportviewers13/js/crviewer/crv.js" type="test/javascript"></script></head>


and placed crystalreportviewers13 folder in project's folder
 
Share this 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