- 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 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> 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 that particular order.
</p>
<p>
<strong>Overview:</strong> The drilldown report shows a way of
displaying a hierarchy of data, in this instance customers --> orders -->
order details.
</p>
<p>
<strong>Implementation Notes: </strong> 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><asp:datalist id="CustomerList" runat="server" ... ></font>
...
<font color=blue><selecteditemtemplate></font>
<font color=red><asp:datalist id="OrderList" runat="server" <font color=blue>DataSource='<%# GetOrders((string)DataBinder.Eval(Container.DataItem, "CustomerID"))</font> %>' ></font>
...
<font color=blue><selecteditemtemplate></font>
<font color=red><asp:datagrid id=OrderDetailsGrid runat="server" <font color=blue>DataSource='<%# GetOrderDetails((int)DataBinder.Eval(Container.DataItem, "OrderID"))</font> %>' ></font>
<columns>
<asp:boundcolumn DataField="ProductName" HeaderText="Product" ... ></asp:boundcolumn>
<asp:boundcolumn DataField="UnitPrice" HeaderText="Unit Price" DataFormatString="{0:c}" ... ></asp:boundcolumn>
<asp:boundcolumn DataField="Quantity" HeaderText="Quantity" ... ></asp:boundcolumn>
</columns>
</asp:datagrid>
</selecteditemtemplate>
</asp:datalist>
</selecteditemtemplate>
</asp:datalist>
</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>
<asp:datalist id="CustomerList" runat="server" ... <font color=blue>OnItemCommand="DataList_ItemCommand"</font> >
...
<itemtemplate>
<font color=red><asp:linkbutton id="button1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CompanyName") %>' CommandName="select" /></font>
</itemtemplate>
<selecteditemtemplate>
<asp:datalist id="OrderList" runat="server" <font color=blue>OnItemCommand="OrdersList_ItemCommand"</font> %>' ></FONT>
...
<itemtemplate>
<font color=red><asp:linkbutton id="Linkbutton1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OrderID") %>' CommandName="select" /></font>
</itemtemplate>
<selecteditemtemplate>
<asp:datagrid id=OrderDetailsGrid runat="server" ... %>' ></FONT>
<columns>
<asp:boundcolumn DataField="ProductName" HeaderText="Product" ... ></asp:boundcolumn>
<asp:boundcolumn DataField="UnitPrice" HeaderText="Unit Price" DataFormatString="{0:c}" ... ></asp:boundcolumn>
<asp:boundcolumn DataField="Quantity" HeaderText="Quantity" ... ></asp:boundcolumn>
</columns>
</asp:datagrid>
</selecteditemtemplate>
</asp:datalist>
</selecteditemtemplate>
</asp:datalist>
</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>
<asp:label id="CustomerID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CustomerID") %>' Visible=False />
</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.
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.