- reporting_kit_conversion_demo.zip
- reports
- bin
- ASPNETReports.dll
- ASPNETReports.dll.bak
- MySql.Data.dll
- MySql.Data.Tests.dll
- MySql.Data.xml
- ChartGenerator.aspx
- components
- crosstab.aspx
- default.aspx
- docs
- drilldown.aspx
- Global.asax
- hierarchical.aspx
- 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
- masterdetail.aspx
- scripts.js
- simplereport.aspx
- sourceviewer
- 1x1.gif
- crosstab.src
- drilldown.src
- grid_background.gif
- hierarchical.src
- masterdetail.src
- simple.src
- srcview.aspx
- style.css
- tabular.src
- tabview.aspx
- textreport.src
- visual.src
- sql
- styles.css
- stylesPrint.css
- tabular.aspx
- textreport.aspx
- visual.aspx
- web.config
|
<html>
<head>
<title>ASP.NET Reporting Documentation</title>
<link rel="stylesheet" href="../style.css">
</head>
<body class="NormalIndent">
<h1>
MasterDetail.aspx Page
</h1>
<p>
<b>Description:</b> The Master Detail page displays a list of
orders filtered by year and optionally by quarter. It provides a summary
breakdown by quarter as well as a more detailed list of all orders for the year
and quarter.
</p>
<p>
<strong>Overview:</strong> This reports show a simple way of
creating and databinding two different <strong>DataGrids</strong> on the same
page, one for the summary and one for the details. Both DataGrids are bound to
two separate stored procedures. For the summary, the results are filtered by
year. For the details, the results are filtered by year and quarter
(optional).
</p>
<P>
The summary breaks down the number of orders shipped and the amount of sales by
quarter. The <strong>Sales Total</strong> for the year is reported at the
bottom of the summary.
</P>
<p>
<img src="../images/1x1.gif" width="25"> <img src="../images/masterdetailsummary.png">
</p>
<p>
The detail displays a list of all the orders for the year and quarter
(optional), reporting on it's Order ID, Order Date, and Sales amount.
</p>
<p>
<img src="../images/1x1.gif" width="25"> <img src="../images/masterdetaildetails.png">
</p>
<p>
The user can specify the year and quarter by selecting them from the <strong>YearDropDownList</strong>
and <strong>QuarterDropDownList</strong> at the top of the page.
</p>
<p>
<strong>Implementation Notes: </strong> Two separate
DataGrids are created and binded to two separate stored procedures named
GetOrderSummary and GetOrderDetails. This is done by calling GetSales and
GetSalesDetails in the MasterDetail component in the Business Logic Layer,
which will utilize the SQLHelper (DAAB) component in the Data Access
Layer. Note that the <strong>YearDropDownList</strong> is used to pass in the
year which the results are filtered by.
</p>
<pre>
<font color=blue>private void</font> BindSummary()
{
SummaryLabel.Text = YearDropDownList.SelectedItem.Text + " Summary";
SummaryDataGrid.DataSource = GetSales(Convert.ToInt32(YearDropDownList.SelectedItem.Value));
SummaryDataGrid.DataBind();
}
<font color=blue>protected</font> MasterDetailReportCollection GetSales(<font color=blue>int</font> year)
{
<font color=blue>return</font> MasterDetailReport.GetSummary(year);
}
</pre>
<p>
In order to calculate the <strong>Sales Total</strong> , an event handler is
added to the Summary DataGrid. We iterate thru the DataGrid's list of table
rows. We use the third cell in each row, which represents the <strong>Sales</strong>
column, to calculate the sales total. This total is then added back to the
actual DataGrid's footer row.
</p>
<pre>
<font color=blue>private void</font> SumItems(<font color=blue>object</font> sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
<font color=blue>if</font> (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
CalcTotal( e.Item.Cells[2].Text );
e.Item.Cells[2].Text = <font color=blue>string</font>.Format("{0:c}", Convert.ToDouble(e.Item.Cells[2].Text));
}
<font color=blue>else if</font> (e.Item.ItemType == ListItemType.Footer )
{
e.Item.Cells[0].Text="Sales Total";
e.Item.Cells[2].Text = <font color=blue>string</font>.Format("{0:c}", _salesTotal);
}
}
<font color=blue>private void</font> CalcTotal(<font color=blue>string</font> _price)
{
_salesTotal += Double.Parse(_price);
}
</pre>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service 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
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.