Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have create crystal report in visul studeio 2012 code like this and my problem is when i call this report. report not display. which problem i am tired. give me solution

Aspx=======
XML
<CR:CrystalReportViewer ID="crpt_print" ReportSourceID="CrystalReportSource1" runat="server" AutoDataBind="true" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"></CR:CrystalReportSource>



CS============
C#
public ReportDocument rpt = new ReportDocument();
   protected void Page_Load(object sender, EventArgs e)
   {
       rpt.FileName = "C:\\Users\\rasmikantm\\Desktop\\aaa\\CrystalReport.rpt";
       crpt_print.ReportSource = rpt;
       rpt.Load("C:\\Users\\rasmikantm\\Desktop\\aaa\\CrystalReport.rpt");
   }
Posted

Try this

C#
public ReportDocument rpt = new ReportDocument();
   protected void Page_Load(object sender, EventArgs e)
   {
       rpt.FileName = "C:\\Users\\rasmikantm\\Desktop\\aaa\\CrystalReport.rpt";
       rpt.Load("C:\\Users\\rasmikantm\\Desktop\\aaa\\CrystalReport.rpt");
       CrystalReportSource1.ReportSource = rpt;
   }


"CrystalReportSource1" is your CrystalReportViewerID .
 
Share this answer
 
v2
this is not working because CrystalReportSource1 not allow ReportSource property
 
Share this answer
 
Comments
IpsitaMishra 13-Nov-14 7:04am    
just use this
<CR:CrystalReportViewer ID="RptViewer" runat="server"/>
in our html page and instead of CrystalReportSource1 use RptViewer

It is working for me..
IpsitaMishra 13-Nov-14 7:04am    
Instead of

<CR:CrystalReportViewer ID="crpt_print" ReportSourceID="CrystalReportSource1" runat="server" AutoDataBind="true" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">

use <CR:CrystalReportViewer ID="RptViewer" runat="server"/>
[no name] 13-Nov-14 7:16am    
i have already insert CrystalReportViewer like this
<CR:CrystalReportViewer ID="crpt_print" ReportSourceID="CrystalReportSource1" runat="server" AutoDataBind="true" />

why use another
<CR:CrystalReportViewer ID="RptViewer" runat="server"/>
[no name] 13-Nov-14 7:18am    
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" Height="1202px" ReportSourceID="CrystalReportSource1" ToolPanelWidth="200px" Width="1104px" ToolPanelView="None" Visible="true"/>
<CR:CrystalReportSource runat="server" ID="CrystalReportSource1" Visible="true">
<report filename="CrystalReport.rpt">


when i use this code in olny aspx page. aspx design view display report but when i run this page report is not display

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