Kazem
Kazem

Reputation: 1538

Crystal Report showing blank page

I am new to Crystal report, using a tutorial i have created a report in VS.2012 and Crystal Report "CRforVS_13_0_5". When i run this report, it shows nothing but a bank page. Even the toolbar of "Crystal Report Viewer" is not shown.

I have searched a lot on google and in Stackoverflow, but none of the solutions given helped me with this.

The steps i have followed to create this report is as below:

  1. Created a DataSet.
  2. Added a Crystal Report into my web project.
  3. Added a new Form "Default.aspx" into my project and added a button into it.
  4. Typed below code in on click event of the code.

My code:

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
    SqlConnection CN;
    String MyConnectionString = "";
    MyConnectionString = "data source=.; initial catalog=Test; user id=sa; password=Abc1234";

    CN = new SqlConnection(MyConnectionString);
    CN.Open();

    string SQL = null;
    SQL = "SELECT * FROM UserInformation ORDER BY Username";

    SqlDataAdapter myDA = new SqlDataAdapter(SQL,CN);
    CN.Close();

    DatasetEmp DS = new DatasetEmp();
    myDA.Fill(DS,"UserInformation");

    ReportDocument myRPT = new ReportDocument();
    myRPT.Load(Server.MapPath("~/CrystalReportEmp.rpt"));
    myRPT.SetDataSource(DS);

    CrystalReportViewer1.ReportSource = myRPT;
}

After i run the code, it shows nothing. like below picture.enter image description here

Upvotes: 1

Views: 19803

Answers (5)

user2647984
user2647984

Reputation: 1

"the code must be paste right after < configuration > tag in web.config file. for me any other place did not work and generated Error message." These config sections and the Business Object node HAVE to be the first nodes in your web.config for Web Forms

Upvotes: 0

I have same problem then I solve it as follows:
1. Copy crystalreportviewers13 foler from C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319 to Project folder ROOT.
2. Copy this in Web.config:

    <configuration>
<configSections>
     <sectionGroup name="businessObjects">
         <sectionGroup name="crystalReports">
               <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
               <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
         </sectionGroup>
     </sectionGroup>
 </configSections>
........................
   <businessObjects>
      <crystalReports>
        <rptBuildProvider>
          <add embedRptInResource="true" />
        </rptBuildProvider>
        <crystalReportViewer>
          <add key="ResourceUri" value="/crystalreportviewers13" />
        </crystalReportViewer>
      </crystalReports>
    </businessObjects>
</configuration>

Good luck.

Upvotes: 0

SivaPrasad
SivaPrasad

Reputation: 11

You need to place aspnet_client files in application folder. If issue not resolved you need to check console errors in browser with press key F12 then you can place the Crystal Report files in specified folder in application.

Upvotes: 1

Kazem
Kazem

Reputation: 1538

After copying the folder "C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13" into your application root folder, be sure you copy and paste the given code below:

    <configSections>
<sectionGroup name="businessObjects">
  <sectionGroup name="crystalReports">
    <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
       <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />
  </sectionGroup>
</sectionGroup>
  </configSections>

<businessObjects>
  <crystalReports>
    <rptBuildProvider>
      <add embedRptInResource="true" />
    </rptBuildProvider>
    <crystalReportViewer>
          <add key="ResourceUri" value="/crystalreportviewers13" />
  </crystalReportViewer>
  </crystalReports>
</businessObjects>

the code must be paste right after < configuration > tag in web.config file. for me any other place did not work and generated Error message.

Upvotes: 1

Muhammad Azim
Muhammad Azim

Reputation: 329

You need to keep aspnet_client folder to your application directory. You will be find this aspnet_client folder in C:\inetpub\wwwroot location.

Upvotes: 4

Related Questions