I have a c# asp.net web project. The reports are designed with crystal report. I can view the report on the server but I cannot view the report on any client system. I am using IIS on the local system.
I am a beginner in c#.
Please assist me.
My aspx is as below:
<asp:Table class="center" style="table-layout: fixed; overflow:hidden; word-wrap:break-word;" ID="Table1" Height="100%" Width="80%" runat="server"> <asp:TableRow> <asp:TableCell HorizontalAlign="Right"> <asp:Label ID="Label2" runat="server" Text="Select Deanery:"></asp:Label> </asp:TableCell> <asp:TableCell ColumnSpan="2"> <asp:DropDownList BackColor="#ADD8E6" ID="ddlDeaneries" OnSelectedIndexChanged="ddlDeaneries_SelectedIndexChanged" DataTextField="DeaneryName" DataValueField="DeaneryCode" AutoPostBack="true" runat="server"></asp:DropDownList> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell > </asp:TableCell> <asp:TableCell ColumnSpan="2" HorizontalAlign="Left"> <asp:Button ID="btnViewAll" OnClick="btnViewAll_Click" runat="server" Text="View All" /> </asp:TableCell> </asp:TableRow> </asp:Table> <div> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" /> </div>
MY aspx.cs is as below:
protected void btnViewAll_Click(object sender, EventArgs e) { try { string CS2 = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; using (SqlConnection con = new SqlConnection(CS2)) { string SelectFeej1e5 = "SELECT * FROM [MinistryTable]"; SqlDataAdapter da5 = new SqlDataAdapter(SelectFeej1e5, con); DataSet ds5 = new DataSet(); da5.Fill(ds5); ReportDocument crp = new ReportDocument(); crp.Load(Server.MapPath("~/CrystalReports/DeaneryMinistryDirectoryCR.rpt")); crp.SetDataSource(ds5.Tables["table"]); CrystalReportViewer1.ReportSource = crp; crp.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "Deanery Ministry Report"); } } catch { //////DONOTHIG } }