- 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><link rel=stylesheet href=style.css></head><body><div class=SourcePanel style='font-size:12'><pre style='background-color:white'>
<%@ Page language="c#" %<font color= "blue">></font>
<%@ Import Namespace="System" %<font color= "blue">></font>
<%@ Import Namespace="System.Web.UI.WebControls" %<font color= "blue">></font>
<%@ Import Namespace="ASPNET.StarterKit.Reports.Components" %<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">script</font> runat="server"<font color= "blue">></font>
<font color= "green"> //*********************************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // CrossTab.aspx</font>
<font color= "green"> //</font>
<font color= "green"> // The CrossTab.aspx page shows quarterly breakdown of sales based on the region.</font>
<font color= "green"> // It also displays the totals for each region, the totals for each month within the quarter,</font>
<font color= "green"> // and the total for the whole quarter.</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"> </font>
<font color= "blue"> private </font>double _eastern = 0;
<font color= "blue"> private </font>double _western = 0;
<font color= "blue"> private </font>double _southern = 0;
<font color= "blue"> private </font>double _northern = 0;
<font color= "blue"> private </font>double _totals = 0;
<font color= "blue"> protected </font>string _styleSheet;
<font color= "blue"></font>
<font color= "blue"> private void</font> Page_Load(object sender, System.EventArgs e)
<font color= "blue"> </font>{
<font color= "blue"></font><font color= "blue"> if </font>(!IsPostBack)<font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "blue"> </font>BindList();
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> // switches the style sheet based on printer friendly view or not</font>
<font color= "blue"></font><font color= "blue"> if </font>(Request.QueryString["Print"]=="true")<font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "blue"> </font>_styleSheet = "stylesPrint.css";
<font color= "blue"> </font>PrintButton.Visible = true;
<font color= "blue"> </font>}
<font color= "blue"></font><font color= "blue"> else </font><font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "blue"> </font>_styleSheet = "styles.css";
<font color= "blue"> </font>}
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*********************************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // The BindList method simply binds the Datalist with the four quarters</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue"> private void</font> BindList()
<font color= "blue"> </font>{
<font color= "blue"> </font>QuartersList.DataSource = new int[4] { 1, 2, 3, 4 };
<font color= "blue"> </font>QuartersList.DataBind();
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*********************************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // The GetQuarterDetails method is set as the DataSource of the inner datagrid.</font>
<font color= "green"> // As the QuartsList is being data-bound, this populates the inner datagrids for the quarters.</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue"> protected </font>CrossTabReportCollection GetQuarterDetails(int quarter)
<font color= "blue"> </font>{
<font color= "blue"> return</font> CrossTabReport.GetRegionSales(quarter, Convert.ToInt32(YearDropDownList.SelectedItem.Value));
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*********************************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // The SumItems event handler is for the OnItemDataBound event of the datagrids for each quarter.</font>
<font color= "green"> // It adds running totals for each region for a particular quarter.</font>
<font color= "green"> // It also adds the sum totals fo the regions of the quarter as well.</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue"> protected void</font> SumItems(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
<font color= "blue"> </font>{
<font color= "green"> // sum up the data in the columns as the datagrid is databinding</font>
<font color= "blue"></font><font color= "blue"> if </font>(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "green"> // get the sales value for eastern region</font>
<font color= "blue"> </font>double eastern = Convert.ToDouble(e.Item.Cells[1].Text);
<font color= "green"> // add sales value to the running total</font>
<font color= "blue"> </font>_eastern += eastern;
<font color= "green"> // format to display sales value as currency</font>
<font color= "blue"> </font>e.Item.Cells[1].Text = string.Format("{0:c}", eastern);
<font color= "blue"></font>
<font color= "blue"> </font>double western = Convert.ToDouble(e.Item.Cells[2].Text);
<font color= "blue"> </font>_western += western;
<font color= "blue"> </font>e.Item.Cells[2].Text = string.Format("{0:c}", western);
<font color= "blue"></font>
<font color= "blue"> </font>double southern = Convert.ToDouble(e.Item.Cells[3].Text);
<font color= "blue"> </font>_southern += southern;
<font color= "blue"> </font>e.Item.Cells[3].Text = string.Format("{0:c}", southern);
<font color= "blue"> </font>
<font color= "blue"> </font>double northern = Convert.ToDouble(e.Item.Cells[4].Text);
<font color= "blue"> </font>_northern += northern;
<font color= "blue"> </font>e.Item.Cells[4].Text = string.Format("{0:c}", northern);
<font color= "blue"> </font>
<font color= "blue"> </font>double totals = Convert.ToDouble(e.Item.Cells[5].Text);
<font color= "blue"> </font>_totals += totals;
<font color= "blue"> </font>e.Item.Cells[5].Text = string.Format("{0:c}", totals);
<font color= "blue"> </font>}
<font color= "blue"></font><font color= "blue"> else if</font>(e.Item.ItemType == ListItemType.Footer )<font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "green"> // display our summations in footer</font>
<font color= "blue"> </font>e.Item.Cells[0].Text = "Totals";
<font color= "blue"> </font>e.Item.Cells[0].HorizontalAlign = HorizontalAlign.Left;
<font color= "blue"> </font>e.Item.Cells[1].Text = string.Format("{0:c}", _eastern);
<font color= "blue"> </font>e.Item.Cells[2].Text = string.Format("{0:c}", _western);
<font color= "blue"> </font>e.Item.Cells[3].Text = string.Format("{0:c}", _southern);
<font color= "blue"> </font>e.Item.Cells[4].Text = string.Format("{0:c}", _northern);
<font color= "blue"> </font>e.Item.Cells[5].Text = string.Format("{0:c}", _totals);
<font color= "blue"></font>
<font color= "green"> // reset the running totals for next datagrid</font>
<font color= "blue"> </font>_eastern = 0;
<font color= "blue"> </font>_western = 0;
<font color= "blue"> </font>_southern = 0;
<font color= "blue"> </font>_northern = 0;
<font color= "blue"> </font>_totals = 0;
<font color= "blue"> </font>}
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "blue"> private void</font> YearDropDownList_SelectedIndexChanged(object sender, System.EventArgs e)
<font color= "blue"> </font>{
<font color= "blue"> </font>BindList();
<font color= "blue"> </font>}
<font color= "blue"></</font><font color="maroon">script</font><font color= "blue">></font>
<font color= "blue"><!</font><font color="maroon">DOCTYPE</font> HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" <font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">html</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">head</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">title</font><font color= "blue">></font>CrossTab<font color= "blue"></</font><font color="maroon">title</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">meta</font> content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">link</font> href="<%= _styleSheet %<font color= "blue">></font>" type=text/css rel=stylesheet<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">script</font> src="scripts.js"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">script</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">head</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">body</font> class="Report" leftmargin="20" topmargin="20" marginheight="0" marginwidth="0"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">form</font> id="CrossTab" method="post" runat="server"<font color= "blue">></font>
Select Year:
<font color= "blue"><</font><font color=blue>asp:dropdownlist id="YearDropDownList" OnSelectedIndexChanged="YearDropDownList_SelectedIndexChanged" runat="server" autopostback="True"</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:listitem value="1996"<font color= "blue">></font>1996<font color= "blue"></</font>asp:listitem</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:listitem value="1997"<font color= "blue">></font>1997<font color= "blue"></</font>asp:listitem</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:listitem value="1998"<font color= "blue">></font>1998<font color= "blue"></</font>asp:listitem</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:dropdownlist</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">br</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">br</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">table</font> cellpadding="0" cellspacing="0" width="635px" border="0"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> class="ReportTitle"<font color= "blue">></font>CrossTab Report<font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> align="right" width="50"<font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:hyperlink id="PrintButton" navigateurl="javascript:Print()" cssclass="printbutton" runat="server" visible="False"<font color= "blue">></font>Print<font color= "blue"></</font>asp:hyperlink<font color= "blue">></font><font color= "blue"></</font><font color="maroon">td</font></font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">table</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:datalist id="QuartersList" runat="server" cellspacing="0" cellpadding="0"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemtemplate</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">table</font> border="0" cellpadding="3" cellspacing="0"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> colspan="2" class="textbold"<font color= "blue">></font>
Quarter
<%# Container.DataItem %<font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> colspan="2"<font color= "blue">></font><font color= "blue"><</font><font color="maroon">img</font> src="images/spacer.gif" height="5"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font><font color= "blue">></font><font color= "blue"><</font><font color="maroon">img</font> src="images/spacer.gif" width="30"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">table</font> border="0" cellpadding="0" cellspacing="0"<font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:datagrid id="DataGrid1" runat="server" width="600" AutoGenerateColumns="False" GridLines="None" ShowFooter="True" DataSource='<%# GetQuarterDetails((int)Container.DataItem) %<font color= "blue">></font>' OnItemDataBound="SumItems" CellPadding="3" CssClass="Content"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">columns</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:templatecolumn headertext="Month" itemstyle-cssclass="ItemStyle" headerstyle-cssclass="HeaderStyle" footerstyle-cssclass="FooterStyle"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemtemplate</font><font color= "blue">></font>
<%# String.Format("{0:MMMM}",DataBinder.Eval(Container.DataItem, "OrderDate")) %<font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">itemtemplate</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:templatecolumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:boundcolumn datafield="Eastern" headertext="Eastern" itemstyle-cssclass="ItemStyleRight" headerstyle-cssclass="HeaderStyleRight" footerstyle-cssclass="FooterStyleRight"<font color= "blue">></font><font color= "blue"></</font>asp:boundcolumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:boundcolumn datafield="Western" headertext="Western" itemstyle-cssclass="ItemStyleRight" headerstyle-cssclass="HeaderStyleRight" footerstyle-cssclass="FooterStyleRight"<font color= "blue">></font><font color= "blue"></</font>asp:boundcolumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:boundcolumn datafield="Southern" headertext="Southern" itemstyle-cssclass="ItemStyleRight" headerstyle-cssclass="HeaderStyleRight" footerstyle-cssclass="FooterStyleRight"<font color= "blue">></font><font color= "blue"></</font>asp:boundcolumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:boundcolumn datafield="Northern" headertext="Northern" itemstyle-cssclass="ItemStyleRight" headerstyle-cssclass="HeaderStyleRight" footerstyle-cssclass="FooterStyleRight"<font color= "blue">></font><font color= "blue"></</font>asp:boundcolumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:boundcolumn datafield="Sales" headertext="Totals" itemstyle-cssclass="ItemStyleRightBold" headerstyle-cssclass="HeaderStyleRight" footerstyle-cssclass="FooterStyleRightBold"<font color= "blue">></font><font color= "blue"></</font>asp:boundcolumn</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">columns</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:datagrid</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">table</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> colspan="2"<font color= "blue">></font><font color= "blue"><</font><font color="maroon">img</font> src="images/spacer.gif" height="10"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">tr</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">table</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">itemtemplate</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">headerstyle</font> cssclass="ReportTitle"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">headerstyle</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:datalist</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">form</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">body</font><font color= "blue">></font>
<font color= "blue"></</font><font color="maroon">html</font><font color= "blue">></font>
</pre>
|
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 member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.