Crystal Report asp.net webform Basic usage examples _ practical skills

Source: Internet
Author: User

This paper illustrates the basic usage of Crystal Report asp.net WebForm. Share to everyone for your reference.

The implementation methods are as follows:

Copy Code code as follows:
protected void Page_Init (object sender, EventArgs e)
{
Configurecrystalreport ();
}
protected void Page_Unload (object sender, EventArgs e)
{
if (rptdocument = null)
Return
Rptdocument.close ();
Rptdocument.dispose ();
}

private void Configurecrystalreport ()
{
String temp = BusinessObject.Util.Decrypt (request.querystring["toid"]);
Tourorderid = util.convertto<int> (temp, 0);

if (viewstate["reportdoc"] = = null)
{
String report_path = "";
Report_path = Server.MapPath ("~/report/tournote.rpt");

DataSet ds = BusinessObject.TourOrders.GetTourNoteDsRpt (Tourorderid);
if (viewstate["reportdata"] = = null)
{
viewstate["reportdata"] = ds;
}
Else
{
ds = (DataSet) viewstate["ReportData"];
}
Rptdocument = new Reportdocument ();
Rptdocument.load (Report_path);
Rptdocument.setdatasource (DS);
RptDocument.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;
viewstate["Reportdoc"] = rptdocument;
}
Else
{
Rptdocument = (reportdocument) viewstate["Reportdoc"];
}

This. Crystalreportviewer1.reportsource = rptdocument;
This. Crystalreportviewer1.hastogglegrouptreebutton = false;
This. Crystalreportviewer1.displaygrouptree = false;
}

Use the method. First set up a dataset as a data source, as a crystal report data structure.

The code calls a stored procedure that returns a dataset that has more than one table.

I hope this article will help you with the ASP.net program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.