- 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"> // SimpleReport.aspx</font>
<font color= "green"> //</font>
<font color= "green"> // This report lists all customer contacts information from the database</font>
<font color= "green"> // in a DataGrid control</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"> </font>
<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>BindGrid();
<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>PagingButton.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 BindGrid method retrieves a collection of simple report items</font>
<font color= "green"> // and databinds it to the CustomerGrid</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue"> private void</font> BindGrid()
<font color= "blue"> </font>{
<font color= "blue"> </font>SimpleReportCollection customerList = SimpleReport.GetCustomerContacts();
<font color= "blue"> </font>SortGridData(customerList, SortField, SortAscending);
<font color= "blue"> </font>CustomerGrid.DataSource = customerList;
<font color= "blue"> </font>CustomerGrid.DataBind();
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*********************************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // The SortGrid event handler changes the sortfield for the Customer grid </font>
<font color= "green"> // and re-binds it.</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue"> private void</font> CustomerGrid_Sort(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
<font color= "blue"> </font>{
<font color= "green"> // change sort field</font>
<font color= "blue"> </font>SortField = (string)e.SortExpression;
<font color= "blue"></font>
<font color= "green"> // re-bind to display new sorting</font>
<font color= "blue"> </font>BindGrid();
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*******************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // SortGridData methods sorts the datagrid based on which</font>
<font color= "green"> // sort field is being selected. Also does reverse sorting based on the boolean.</font>
<font color= "green"> //</font>
<font color= "green"> //*******************************************************</font>
<font color= "blue"></font>
<font color= "blue"> private void</font> SortGridData(SimpleReportCollection list, string sortField, bool asc)
<font color= "blue"> </font>{
<font color= "blue"> </font>SimpleReportCollection.SimpleReportFields sortCol = SimpleReportCollection.SimpleReportFields.InitValue;
<font color= "blue"></font>
<font color= "blue"> </font>switch(sortField)
<font color= "blue"> </font>{
<font color= "blue"> case</font> "City":
<font color= "blue"> </font>sortCol = SimpleReportCollection.SimpleReportFields.City;
<font color= "blue"> </font>break;
<font color= "blue"> case</font> "CompanyName":
<font color= "blue"> </font>sortCol = SimpleReportCollection.SimpleReportFields.CompanyName;
<font color= "blue"> </font>break;
<font color= "blue"> case</font> "ContactName":
<font color= "blue"> </font>sortCol = SimpleReportCollection.SimpleReportFields.ContactName;
<font color= "blue"> </font>break;
<font color= "blue"> case</font> "ContactTitle":
<font color= "blue"> </font>sortCol = SimpleReportCollection.SimpleReportFields.ContactTitle;
<font color= "blue"> </font>break;
<font color= "blue"> case</font> "Phone":
<font color= "blue"> </font>sortCol = SimpleReportCollection.SimpleReportFields.Phone;
<font color= "blue"> </font>break;
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "blue"> </font>list.Sort(sortCol, asc);
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*******************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // CustomerGrid_PageIndexChanged server event handler on this page is used</font>
<font color= "green"> // for changing page index</font>
<font color= "green"> //</font>
<font color= "green"> //*******************************************************</font>
<font color= "blue"></font>
<font color= "blue"> private void</font> CustomerGrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
<font color= "blue"> </font>{
<font color= "blue"> </font>CustomerGrid.CurrentPageIndex = e.NewPageIndex;
<font color= "blue"> </font>BindGrid();
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*******************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // pagingButton_Click server event handler on this page is used</font>
<font color= "green"> // for changing paging property on CustomerGrid</font>
<font color= "green"> //</font>
<font color= "green"> //*******************************************************</font>
<font color= "blue"> private void</font> pagingButton_Click(object sender, System.EventArgs e)
<font color= "blue"> </font>{
<font color= "blue"> </font>CustomerGrid.AllowPaging = !CustomerGrid.AllowPaging;
<font color= "blue"> </font>BindGrid();
<font color= "blue"></font>
<font color= "blue"> </font>PagingButton.Text = CustomerGrid.AllowPaging ? "Disable Paging" : "Enable Paging";
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "blue"> </font>string SortField
<font color= "blue"> </font>{
<font color= "blue"> get</font>
<font color= "blue"> </font>{
<font color= "blue"> </font>object o = ViewState["SortField"];
<font color= "blue"></font><font color= "blue"> if </font>(o == null) <font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "blue"> return</font> String.Empty;
<font color= "blue"> </font>}
<font color= "blue"> return</font> (string)o;
<font color= "blue"> </font>}
<font color= "blue"> set</font>
<font color= "blue"> </font>{
<font color= "blue"></font><font color= "blue"> if </font>(value == SortField) <font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "green"> // same as current sort file, toggle sort direction</font>
<font color= "blue"> </font>SortAscending = !SortAscending;
<font color= "blue"> </font>}
<font color= "blue"> </font>ViewState["SortField"] = value;
<font color= "blue"> </font>}
<font color= "blue"> </font>}
<font color= "blue"></font>
<font color= "green"> //*********************************************************************</font>
<font color= "green"> //</font>
<font color= "green"> // SortAscending property is tracked in ViewState</font>
<font color= "green"> //</font>
<font color= "green"> //*********************************************************************</font>
<font color= "blue"></font>
<font color= "blue"> </font>bool SortAscending
<font color= "blue"> </font>{
<font color= "blue"> get</font>
<font color= "blue"> </font>{
<font color= "blue"> </font>object o = ViewState["SortAscending"];
<font color= "blue"></font>
<font color= "blue"></font><font color= "blue"> if </font>(o == null) <font color= "blue"></font>
<font color= "blue"> </font>{
<font color= "blue"> return</font> true;
<font color= "blue"> </font>}
<font color= "blue"> return</font> (bool)o;
<font color= "blue"> </font>}
<font color= "blue"> set</font>
<font color= "blue"> </font>{
<font color= "blue"> </font>ViewState["SortAscending"] = value;
<font color= "blue"> </font>}
<font color= "blue"> </font>}
<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>Simple Report<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="0" topMargin="0" marginwidth="0" marginheight="0"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">form</font> id="Simple" method="post" runat="server"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">table</font> width="100%" cellpadding="0" cellspacing="0"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">tr</font> height="20"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> colspan="3"<font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">table</font> border="0" cellpadding="0" cellspacing="0" width="100%"<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="4"<font color= "blue">></font><font color= "blue"><</font><font color="maroon">img</font> src="images/spacer.gif" width="50" height="20"<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> width="20"<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> class="ReportTitle"<font color= "blue">></font>Customer Contacts<font color= "blue"></</font><font color="maroon">td</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> align="right"<font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:LinkButton id="PagingButton" runat="server" cssclass="printbutton" Visible="False" OnClick="pagingButton_Click"<font color= "blue">></font>Disable Paging<font color= "blue"></</font>asp:LinkButton</font><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">td</font> width="20"<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="4"<font color= "blue">></font><font color= "blue"><</font><font color="maroon">img</font> src="images/spacer.gif" width="20" height="20"<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">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> width="20"<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=blue>asp:datagrid id="CustomerGrid" OnPageIndexChanged="CustomerGrid_PageIndexChanged" OnSortCommand="CustomerGrid_Sort" AlternatingItemStyle-CssClass="Content" runat="server" AutoGenerateColumns="False" BorderWidth="0" GridLines="None" Width="100%" AllowSorting="True" AllowPaging="True" PageSize="20" CellPadding="5"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">alternatingitemstyle</font> cssclass="Content"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">alternatingitemstyle</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:BoundColumn DataField="CompanyName" SortExpression="CompanyName" HeaderText="Company"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">headerstyle</font> cssclass="CategoryHeader"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">headerstyle</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemstyle</font> cssclass="ItemStyle"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">itemstyle</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:BoundColumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:BoundColumn DataField="ContactName" SortExpression="ContactName" HeaderText="Contact"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">headerstyle</font> cssclass="CategoryHeader"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">headerstyle</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemstyle</font> cssclass="ItemStyle"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">itemstyle</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:BoundColumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:BoundColumn DataField="ContactTitle" SortExpression="ContactTitle" HeaderText="Title"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">headerstyle</font> cssclass="CategoryHeader"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">headerstyle</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemstyle</font> cssclass="ItemStyle"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">itemstyle</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:BoundColumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:BoundColumn DataField="Phone" SortExpression="Phone" HeaderText="Telephone"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">headerstyle</font> cssclass="CategoryHeader"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">headerstyle</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemstyle</font> cssclass="ItemStyle"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">itemstyle</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>asp:BoundColumn</font><font color= "blue">></font>
<font color= "blue"><</font><font color=blue>asp:BoundColumn DataField="City" SortExpression="City" HeaderText="City"</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">headerstyle</font> cssclass="CategoryHeader"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">headerstyle</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">itemstyle</font> cssclass="ItemStyle"<font color= "blue">></font><font color= "blue"></</font><font color="maroon">itemstyle</font><font color= "blue">></font>
<font color= "blue"></</font><font color=blue>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">td</font><font color= "blue">></font>
<font color= "blue"><</font><font color="maroon">td</font> width="20"<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">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.