Reporting_Kit_Conversion_demo.zip
reports
bin
ASPNETReports.dll
ASPNETReports.dll.bak
MySql.Data.dll
MySql.Data.Tests.dll
components
bin
Release
ASPNETReports.dll
BLL
DAL
docs
images
1x1.gif
crosstabnestedcontrols.png
crosstabtotals.png
customers.gif
drilldownnestedcontrols.png
employees.gif
getorderdetails.gif
GetOrders.gif
hierarchicalpaging.gif
hierarchicalreport.gif
hierarchicalschema.gif
hierarchicalsorting.gif
masterdetaildetails.png
masterdetailsummary.png
masterdetailtables.png
querysample.gif
querysample2.gif
simpleoverview.png
simplesp.png
tabcolorcode.png
tabdetail.png
tabheader.gif
tabheader.png
tabnestedcontrols.png
tabsortshot.png
tabularextendedprice.png
textshot.gif
viscategorysales.gif
viscategorysales.png
vischartstructure.png
xtabsql.png
Global.asax
images
1x1.gif
asp.net-reports.gif
background.gif
crosstab.gif
crosstabnestedcontrols.png
crosstabtotals.png
customers.gif
drilldown.gif
drilldownnestedcontrols.png
employees.gif
getorderdetails.gif
GetOrders.gif
grid_background.gif
hierarchal.gif
hierarchical.gif
hierarchicalpaging.gif
hierarchicalreport.gif
hierarchicalschema.gif
hierarchicalsorting.gif
logo.gif
logo-neg.gif
masterdetail.gif
masterdetaildetails.png
masterdetails.gif
masterdetailsummary.png
masterdetailtables.png
matrix.gif
querysample.gif
querysample2.gif
reporting.gif
report-table-bg.gif
simple.gif
simpleoverview.png
simplesp.png
spacer.gif
tabcolorcode.png
tabdetail.png
tabheader.gif
tabheader.png
tabnestedcontrols.png
tabsortshot.png
tabular.gif
tabularcolorcode.png
tabularextendedprice.png
tabularsorting.png
text.gif
textalternate.gif
textreport.gif
textshot.gif
viscategorysales.gif
viscategorysales.png
vischartstructure.png
visual.gif
xtabsql.png
sourceviewer
1x1.gif
crosstab.src
drilldown.src
grid_background.gif
hierarchical.src
masterdetail.src
simple.src
tabular.src
textreport.src
visual.src
sql
|
<html>
<head>
<title>ASP.NET Reports Starter Kit Documentation</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="NormalIndent">
<h1>
CrossTab.aspx Page
</h1>
<p>
<b>Description:</b> The CrossTab.aspx page shows a quarterly
breakdown of sales based on geographical region. It also displays the totals
for each region, the totals for each month within the quarter, and the total
for the whole quarter.
</p>
<p>
<strong>Overview:</strong> The CrossTab Report shows totals for
each region in the footer of the Datagrid. The totals for each month of the
quarter are shown in the rightmost column. The grand total for the quarter is
calculated and displayed in the bottom right corner.
</p>
<p>
<img src="../images/1x1.gif" width="25"> <img src="../images/crosstabtotals.png">
</p>
<p>This report uses the same technique of grouping related data that is used in the
Tabular report (in this case, grouping sales data by quarter). The grouping is
done by nesting a DataGrid control inside of a DataList control.
</p>
<p>
Since the data is time-based, to provide better performance the reports are
filtered by year.</p>
<p>
<strong>Implementation Notes: </strong> As the Datagrids for each
quarter are being databound, the running totals are summed.
</p>
<pre>
//*********************************************************************
//
// The SumItems event handler is for the OnItemDataBound event of the datagrids for each quarter.
// It adds running totals for each region for a particular quarter.
// It also adds the sum totals fo the regions of the quarter as well.
//
//*********************************************************************
protected void SumItems(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
// sum up the data in the columns as the datagrid is databinding
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
// get the sales value for eastern region
double eastern = Convert.ToDouble(e.Item.Cells[1].Text);
// add sales value to the running total
_eastern += eastern;
// format to display sales value as currency
e.Item.Cells[1].Text = string.Format("{0:c}", eastern);
double western = Convert.ToDouble(e.Item.Cells[2].Text);
_western += western;
e.Item.Cells[2].Text = string.Format("{0:c}", western);
double southern = Convert.ToDouble(e.Item.Cells[3].Text);
_southern += southern;
e.Item.Cells[3].Text = string.Format("{0:c}", southern);
double northern = Convert.ToDouble(e.Item.Cells[4].Text);
_northern += northern;
e.Item.Cells[4].Text = string.Format("{0:c}", northern);
double totals = Convert.ToDouble(e.Item.Cells[5].Text);
_totals += totals;
e.Item.Cells[5].Text = string.Format("{0:c}", totals);
}
else if(e.Item.ItemType == ListItemType.Footer )
{
// display our summations in footer
e.Item.Cells[0].Text = "Totals";
e.Item.Cells[0].HorizontalAlign = HorizontalAlign.Left;
e.Item.Cells[1].Text = string.Format("{0:c}", _eastern);
e.Item.Cells[2].Text = string.Format("{0:c}", _western);
e.Item.Cells[3].Text = string.Format("{0:c}", _southern);
e.Item.Cells[4].Text = string.Format("{0:c}", _northern);
e.Item.Cells[5].Text = string.Format("{0:c}", _totals);
// resest the running totals for next datagrid
_eastern = 0;
_western = 0;
_southern = 0;
_northern = 0;
_totals = 0;
}
}
</pre>
<p>
To group the related data, a DataGrid control is nested inside of a DataList
control. The DataGrid control is used here since it is more flexible
to format the look and feel of it.
</p>
<p>
<img src="../images/1x1.gif" width="25"> <img src="../images/crosstabnestedcontrols.png">
</p>
<p>The filter by year is done by calling the GetRegionSales method with the
selected year filter.</p>
<pre>
protected SalesReportCollection GetQuarterDetails(int quarter)
{
return SalesReport.GetRegionSales(quarter, Convert.ToInt32(YearDropDownList.SelectedItem.Value));
}
</pre>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here