Search code examples
c#asp.netvisual-studio-2012crystal-reports

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


Solution

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