Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Conversion of Reporting Starter Kit to use Mono/MySQL

, 1 Oct 2005
A porting of the ASP.NET reporting starter kit to use Mono, MySQL and Apache on a Linux system.
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-neg.gif
logo.gif
masterdetail.gif
masterdetaildetails.png
masterdetails.gif
masterdetailsummary.png
masterdetailtables.png
matrix.gif
querysample.gif
querysample2.gif
report-table-bg.gif
reporting.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
<%@ Page language="c#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="ASPNET.StarterKit.Reports.Components" %>

<script runat="server">
	//*********************************************************************
	//
	// DrillDown.aspx
	//
	// The drilldown report displays customer order info. Users are presented with 
	// a list of customers. From there, they can focus in on a customer and see the
	// orders shipped to that customer. Then, they can focus in on an order ID to 
	// view the details for a particular order.
	//
	//*********************************************************************
	
	protected string _styleSheet;

	private const string _customerID = "CustomerID";

	private void Page_Load(object sender, System.EventArgs e)
	{
		if (!IsPostBack)
		{
			BindList();
		}

		// switches the style sheet based on printer friendly view or not
		if (Request.QueryString["Print"]=="true")
		{
			_styleSheet = "stylesPrint.css";
			PrintButton.Visible = true;
		}
		else 
		{
			_styleSheet = "styles.css";
		}
	}

	//*********************************************************************
	//
	// The BindList method retrieves the list of customers
	// and then databinds them to the Customers Datalist
	//
	//*********************************************************************

	private void BindList()
	{
		CustomerList.DataSource = DrillDownReport.GetCustomers();
		CustomerList.DataBind();
	}

	//*******************************************************
	//
	// DataList_ItemCommand event handler is tied to the OnItemDataBound of the Customers DataList.
	// It sets the selected index of the Customers List and then re-binds.
	//
	//*******************************************************

	protected void CustomersList_ItemCommand(object Sender, DataListCommandEventArgs e) 
	{
		// change the Datalist to selected index
		string cmd = ((LinkButton)e.CommandSource).CommandName;
		if (cmd == "select")
			((DataList)Sender).SelectedIndex = e.Item.ItemIndex;

		// re-bind to display data with the new selected index
		BindList();

		// store the customer id to re-bind in the orders list
		ViewState[_customerID] = ((Label)e.Item.FindControl("CustomerID")).Text;
	}

	//*******************************************************
	//
	// OrdersList_ItemCommand event handler is tied to the OnItemDataBound of the Orders DataList.
	// It sets the selected index of the Orders List and then re-binds.
	//
	//*******************************************************

	protected void OrdersList_ItemCommand(object Sender, DataListCommandEventArgs e) 
	{
		// change the selected index of Orders Datalist
		string cmd = ((LinkButton)e.CommandSource).CommandName;
		DataList sender = (DataList)Sender;
		if (cmd == "select")
			sender.SelectedIndex = e.Item.ItemIndex;

		// re-bind to display orders info with new selected index.
		sender.DataSource = GetOrders((string)ViewState[_customerID]);
		sender.DataBind();
	}

	//*********************************************************************
	//
	// The GetOrders method calls the BLL to retrieve the list of orders shipped
	// for customer with customerID.
	//
	//*********************************************************************

	protected DrillDownReportCollection GetOrders(string customerID)
	{
		// only use the customerID in session if it doesn't exist.
		if (customerID == null)
			customerID = (string)ViewState[_customerID];

		return DrillDownReport.GetOrders(customerID);
	}

	//*********************************************************************
	//
	// The GetOrderDetails method calls the BLL to retrieve order info given an order id.
	//
	//*********************************************************************

	protected DrillDownReportCollection GetOrderDetails(int orderID)
	{
		return DrillDownReport.GetOrderDetails(orderID);
	}
</script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
	<head>
		<title>DrillDown</title>
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<link href="<%= _styleSheet %>" type=text/css rel=stylesheet>
		<script src="scripts.js"></script>
	</head>
	<body class="Report" leftmargin="17" topmargin="17">
		<form id="DrillDown" method="post" runat="server">
			<table border="0" cellspacing="0" cellpadding="0" width="700px">
				<tr>
					<td class="ReportTitle" width="650px">Customer Shipped Order Info</td>
					<td align="right" width="50px">
						<asp:hyperlink id="PrintButton" navigateurl="javascript:Print()" cssclass="printbutton" runat="server" visible="False">Print</asp:hyperlink>
					</td>
				</tr>
				<tr>
					<td colspan="2"><img src="images/spacer.gif" height="10"></td>
				</tr>
				<tr>
					<td colspan="2">
						<asp:datalist id="CustomerList" runat="server" repeatdirection="Vertical" headerstyle-cssclass="CategoryHeader" alternatingitemstyle-cssclass="Content" selecteditemstyle-cssclass="Selected" repeatcolumns="1" width="100%" cellpadding="0" cellspacing="0" onitemcommand="CustomersList_ItemCommand">
							<headertemplate>
								Customers
							</headertemplate>
							<itemtemplate>
								<table border="0" cellpadding="5" cellspacing="0" width="100%">
									<tr>
										<td valign="top">
											<asp:linkbutton id="button1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CompanyName") %>' CommandName="select" />
											<asp:label id="CustomerID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CustomerID") %>' Visible=False />
										</td>
									</tr>
								</table>
							</itemtemplate>
							<selecteditemtemplate>
								<table border="0" cellpadding="5" cellspacing="0" width="100%">
									<tr>
										<td valign="top" class="Content">
											<b>
												<%# DataBinder.Eval(Container.DataItem, "CompanyName") %>
											</b>
										</td>
									</tr>
									<tr>
										<td>
											<table border="0" cellpadding="0" cellspacing="0">
												<tr>
													<td valign="top" class="OrderID">
														<img src="images/spacer.gif" width="20" height="1">
													</td>
													<td>
														<asp:datalist id="OrderList" runat="server" DataSource='<%# GetOrders((string)DataBinder.Eval(Container.DataItem, "CustomerID")) %>' RepeatDirection="Vertical" repeatcolumns="1" Width="100%" CellPadding="0" cellspacing="0" OnItemCommand="OrdersList_ItemCommand">
															<headertemplate>
																<table border="0" cellpadding="0" cellspacing="0" width="100%">
																	<tr>
																		<td width="100" class="bold">Order ID</td>
																		<td width="200" class="bold">Order Date</td>
																		<td class="bold">Shipped Date</td>
																	</tr>
																</table>
															</headertemplate>
															<separatortemplate>
																<hr>
															</separatortemplate>
															<itemtemplate>
																<table border="0" cellpadding="0" cellspacing="0" width="100%">
																	<tr>
																		<td width="100">
																			<asp:linkbutton id="Linkbutton1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OrderID") %>' CommandName="select" />
																		</td>
																		<td width="200">
																			<asp:label id="Label6" runat="server" Text='<%# string.Format("{0:d}", DataBinder.Eval(Container.DataItem, "OrderDate")) %>'/>
																		</td>
																		<td>
																			<asp:label id="Label7" runat="server" Text='<%# string.Format("{0:d}", DataBinder.Eval(Container.DataItem, "ShippedDate")) %>' />
																		</td>
																	</tr>
																</table>
															</itemtemplate>
															<selecteditemtemplate>
																<table border="0" cellpadding="0" cellspacing="0" width="100%">
																	<tr>
																		<td>
																			<table border="0" cellpadding="0" cellspacing="0" width="100%">
																				<tr>
																					<td width="100" class="ColoredOrder">
																						<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
																					</td>
																					<td width="200">
																						<asp:label id="Label2" runat="server" Text='<%# string.Format("{0:d}", DataBinder.Eval(Container.DataItem, "OrderDate")) %>'/>
																					</td>
																					<td>
																						<asp:label id="Label3" runat="server" Text='<%# string.Format("{0:d}", DataBinder.Eval(Container.DataItem, "ShippedDate")) %>' />
																					</td>
																				</tr>
																			</table>
																			<hr>
																			<table border="0" cellpadding="0" cellspacing="0">
																				<tr>
																					<td valign="top" class="OrderID">
																						<img src="images/spacer.gif" width="100" height="1">
																					</td>
																					<td>
																						<asp:label id="Label4" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ShipAddress") %>' CssClass=ColoredOrder/>
																						<asp:label id="Label5" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ShipCity") %>' CssClass=ColoredOrder/>,
																						<asp:label id="Label8" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ShipCountry") %>' CssClass=ColoredOrder/>
																						<asp:label id="Label9" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ShipPostalCOde") %>' CssClass=ColoredOrder/><br>
																						<asp:datagrid id=OrderDetailsGrid runat="server" autogeneratecolumns="false" DataSource='<%# GetOrderDetails((int)DataBinder.Eval(Container.DataItem, "OrderID")) %>' BorderWidth="0" GridLines="None" Width="100%">
																							<columns>
																								<asp:boundcolumn datafield="ProductName" headertext="Product" itemstyle-cssclass="ItemStyle" headerstyle-cssclass="ProductHeader" itemstyle-width="200"></asp:boundcolumn>
																								<asp:boundcolumn datafield="UnitPrice" headertext="Unit Price" itemstyle-cssclass="ItemStyleRight" headerstyle-cssclass="ProductHeader" sortexpression="UnitPrice" dataformatstring="{0:c}" itemstyle-width="70"></asp:boundcolumn>
																								<asp:boundcolumn datafield="Quantity" headertext="Quantity" itemstyle-cssclass="ItemStyleRight" headerstyle-cssclass="ProductHeaderRight" itemstyle-width="100"></asp:boundcolumn>
																							</columns>
																						</asp:datagrid>
																					</td>
																				</tr>
																			</table>
																		</td>
																	</tr>
																</table>
															</selecteditemtemplate>
														</asp:datalist>
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</selecteditemtemplate>
						</asp:datalist>
					</td>
				</tr>
			</table>
		</form>
	</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.

License

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

Share

About the Author

StylezHouse
Web Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 1 Oct 2005
Article Copyright 2005 by StylezHouse
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid