Crystal Report Viewer - ASP.net -
i attempting add crystal report viewer asp.net web app. using reports created our desktop application created , functional. connecting same database same query across both platforms , database , query set in report designer.
here's preview 1 of reports in visual studio pro 2015 in asp.net project:
i have added following line reports.aspx page:
<cr:crystalreportviewer id="crptviewer" runat="server" autodatabind="true" />
i added "crystalreportviewers13" folder root of application directory content of crystal report installation.
i have added following web.config file:
<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>
i have tried several strategies on code behind based on different stack overflow suggestions. here's i've tried far:
on button click:
public partial class reports : system.web.ui.page { reportdocument rptdocument; protected void page_load(object sender, eventargs e) { string stack = "page_load()(reports.aspx.cs)"; try { if (session["report"] != null) { crptviewer.reportsource = session["report"]; } } catch (exception ex) { ioclass.appendlog("error in " + stack, ex.message); } } //button click protected void generatereport(object sender, eventargs e) { rptdocument = new reportdocument(); rptdocument.load(server.mappath("~/crystal/userlisting.rpt")); rptdocument.setparametervalue("company", 1); session["report"] = rptdocument; } }
and on load:
public partial class reports : system.web.ui.page { reportdocument rptdocument; protected void page_load(object sender, eventargs e) { string stack = "page_load()(reports.aspx.cs)"; try { rptdocument = new reportdocument(); rptdocument.load(server.mappath("~\\crystal\\userlisting.rpt")); crptviewer.reportsource = rptdocument; //i have tried , without following: //crptviewer.databind(); //and //crptviewer.refreshreport(); } catch (exception ex) { ioclass.appendlog("error in " + stack, ex.message); } } }
when page loads in both cases get:
i'm doing exception logging on load function , not exceptions.
any ideas i'm doing wrong here? let me know if can provide other information.
thank time
Comments
Post a Comment