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

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
<html>
	<head>
		<title>ASP.NET Reports Starter Kit Documentation</title>
		<link href="../style.css" type="text/css" rel="stylesheet">
	</head>
	<body class="NormalIndent">
		<h1>
			DrillDown Report
		</h1>
		<p>
			<b>Description:</b> &nbsp;&nbsp;&nbsp;The drilldown report displays customer 
			shipped order information. Users are presented with a list of customers. From 
			there, they can click on a customer and see the orders shipped to that 
			customer. Furthermore, they can click on an order ID to view the details 
			for&nbsp;that particular order.
		</p>
		<p>
			<strong>Overview:</strong>&nbsp;&nbsp;&nbsp;The drilldown report shows a way of 
			displaying a hierarchy of data, in this instance customers --&gt; orders --&gt; 
			order details.
		</p>
		<p>
			<strong>Implementation Notes:&nbsp;</strong> &nbsp; The list of customers is a 
			Datalist. Inside of the selected template for the Customers Datalist is the 
			Orders Datalist. And inside of the Orders Datalist's selected template is the 
			Order Details Datagrid. The selected template determines the content and layout 
			of the selected item of datalist.
		</p>
		<p>
			<img src="../images/1x1.gif" width="25"> <img src="../images/drilldownnestedcontrols.png">
		</p>
		<p>
			The Datalist is used for the customers and orders list because of its selected 
			template feature. The Datagrid is used to easily display the Order details 
			since it does not require a selected template.
		</p>
		<pre>
	<font color=red>&lt;asp:datalist id="CustomerList" runat="server" ... &gt;</font>
		...
		<font color=blue>&lt;selecteditemtemplate&gt;</font>
			<font color=red>&lt;asp:datalist id="OrderList" runat="server" <font color=blue>DataSource='&lt;%# GetOrders((string)DataBinder.Eval(Container.DataItem, "CustomerID"))</font> %&gt;' &gt;</font>
				...
				<font color=blue>&lt;selecteditemtemplate&gt;</font>
					<font color=red>&lt;asp:datagrid id=OrderDetailsGrid runat="server" <font color=blue>DataSource='&lt;%# GetOrderDetails((int)DataBinder.Eval(Container.DataItem, "OrderID"))</font> %&gt;' &gt;</font>
						&lt;columns&gt;
							&lt;asp:boundcolumn DataField="ProductName" HeaderText="Product" ... &gt;&lt;/asp:boundcolumn&gt;
							&lt;asp:boundcolumn DataField="UnitPrice" HeaderText="Unit Price" DataFormatString="{0:c}" ... &gt;&lt;/asp:boundcolumn&gt;
							&lt;asp:boundcolumn DataField="Quantity" HeaderText="Quantity" ... &gt;&lt;/asp:boundcolumn&gt;
						&lt;/columns&gt;
					&lt;/asp:datagrid&gt;
				&lt;/selecteditemtemplate&gt;
			&lt;/asp:datalist&gt;
		&lt;/selecteditemtemplate&gt;
	&lt;/asp:datalist&gt;
		</pre>
		<p>To show the selected itemtemplate, an event is added to the CustomerList. An 
			event handler is also added to the OrdersList. The event handler looks to see 
			if a "select" command is called and sets the selected index of the 
			corresponding Datalist and then re-binds the Datalist.</p>
		<pre>
	&lt;asp:datalist id="CustomerList" runat="server" ...  <font color=blue>OnItemCommand="DataList_ItemCommand"</font> &gt;
		...
		&lt;itemtemplate&gt;
			<font color=red>&lt;asp:linkbutton id="button1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CompanyName") %>' CommandName="select" /&gt;</font>
		&lt;/itemtemplate&gt;
		&lt;selecteditemtemplate&gt;
			&lt;asp:datalist id="OrderList" runat="server" <font color=blue>OnItemCommand="OrdersList_ItemCommand"</font> %&gt;' &gt;</FONT>
				...
				&lt;itemtemplate&gt;
					<font color=red>&lt;asp:linkbutton id="Linkbutton1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OrderID") %>' CommandName="select" /&gt;</font>
				&lt;/itemtemplate&gt;
				&lt;selecteditemtemplate&gt;
					&lt;asp:datagrid id=OrderDetailsGrid runat="server" ... %&gt;' &gt;</FONT>
						&lt;columns&gt;
							&lt;asp:boundcolumn DataField="ProductName" HeaderText="Product" ... &gt;&lt;/asp:boundcolumn&gt;
							&lt;asp:boundcolumn DataField="UnitPrice" HeaderText="Unit Price" DataFormatString="{0:c}" ... &gt;&lt;/asp:boundcolumn&gt;
							&lt;asp:boundcolumn DataField="Quantity" HeaderText="Quantity" ... &gt;&lt;/asp:boundcolumn&gt;
						&lt;/columns&gt;
					&lt;/asp:datagrid&gt;
				&lt;/selecteditemtemplate&gt;
			&lt;/asp:datalist&gt;
		&lt;/selecteditemtemplate&gt;
	&lt;/asp:datalist&gt;
		</pre>
		<p>Since the Orders Datalist is inside of the Customers Datalist's selected 
			template, it is dynamically generated as the Customers Datalist is data 
			binding. The Customers Datalist passes in the customer ID of the selected 
			customer to the Orders Datalist. The Orders DataList then binds to the orders 
			for that selected customer.</p>
		<p>The customer ID is placed in a hidden label control so that it can be retrieve 
			in the OnItemCommand event of the Customers Datalist.
		</p>
		<pre>
	&lt;asp:label id="CustomerID" runat="server" Text='&lt;%# DataBinder.Eval(Container.DataItem, "CustomerID") %&gt;' Visible=False /&gt;
		</pre>
		<p>The customer ID is saved in ViewState in the OnItemCommand event of the Customers Datalist. The 
			customer ID must be saved so that when the Orderlist selected index changes, 
			it can re-bind to the correct customer. It is retrieved when the page 
			is posted back and the OnItemCommand event is raised for the Orders Datalist.
		</p>
		<pre>			
	protected void DataList_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();

		<font color=blue>// store the customer id to re-bind in the orders list
		ViewState[_customerID] = ((Label)e.Item.FindControl("CustomerID")).Text;</font>
	}
		</pre>
		<pre>
	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;

		<font color=blue>// re-bind to display orders info with new selected index.
		sender.DataSource = GetOrders((string)ViewState[_customerID]);
		sender.DataBind();</font>
	}		
		</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.

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
Web04 | 2.8.140905.1 | Last Updated 1 Oct 2005
Article Copyright 2005 by StylezHouse
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid