<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.PivotGrid.Examples.Templates.DefaultCS" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
<title>Telerik ASP.NET Example</title>
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="radAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
<telerik:RadPivotGrid RenderMode="Lightweight" ID="RadPivotGrid1" runat="server" DataSourceID="SqlDataSource1"
ShowFilterHeaderZone="false" AllowPaging="true" PageSize="10" OnCellDataBound="RadPivotGrid1_CellDataBound"
ColumnGroupsDefaultExpanded="false">
<Fields>
<telerik:PivotGridColumnField DataField="Months" UniqueName="Months" Caption="Months">
<TotalHeaderCellTemplate>
<asp:Label Text='<%# "Number of visitors for " + GetDataItem().ToString().Split(new string[] { " " }, StringSplitOptions.None)[0] %>'
runat="server" />
</TotalHeaderCellTemplate>
</telerik:PivotGridColumnField>
<telerik:PivotGridColumnField DataField="TimeOfDay" UniqueName="TimeOfDay" Caption="Time of day">
<TotalHeaderCellTemplate>
<asp:Label ID="Label1" Text='<%# "Dishes sold for " + GetDataItem().ToString().Split(new string[] { " " }, StringSplitOptions.None)[0] %>'
runat="server" />
</TotalHeaderCellTemplate>
</telerik:PivotGridColumnField>
<telerik:PivotGridRowField DataField="RestaurantName" UniqueName="RestaurantName" Caption="Restaurant name">
</telerik:PivotGridRowField>
<telerik:PivotGridRowField DataField="DishesData" UniqueName="DishesData" Caption="Dishes">
<CellTemplate>
<asp:Label ID="DishesDataLabel" runat="server" Text='<%# GetDataItem().ToString().Split(new string[] { "__" }, StringSplitOptions.None)[1] %>'></asp:Label>
<br />
<asp:Image ID="Image1" Width="90px" Height="90px" runat="server" ImageUrl='<%# String.Format("../../../Img/Northwind/Products/Thumbs/{0}.jpg", GetDataItem().ToString().Split(new string[] { "__" }, StringSplitOptions.None)[0]) %>'
AlternateText='<%# String.Format("{0}", GetDataItem().ToString().Split(new string[] { "__" }, StringSplitOptions.None)[1]) %>' />
</CellTemplate>
</telerik:PivotGridRowField>
<telerik:PivotGridAggregateField DataField="NumberOfVisitors" Aggregate="Sum" UniqueName="NumberOfVisitors" Caption="Number of visitors">
<HeaderCellTemplate>
<asp:Label ID="AggregateCell1" Text="Number of visitors" runat="server" />
</HeaderCellTemplate>
<ColumnGrandTotalHeaderCellTemplate>
<asp:Label Text="Total number of visitors" runat="server" />
</ColumnGrandTotalHeaderCellTemplate>
</telerik:PivotGridAggregateField>
<telerik:PivotGridAggregateField DataField="SoldDishes" Aggregate="Sum" UniqueName="SoldDishesSum" Caption="Dishes sold">
<CellTemplate>
<asp:Label ID="SoldDishesLabel" runat="server" Text='<%# GetDataItem() %>'></asp:Label>
<asp:Image ID="SoldDishesImage" runat="server" Visible="true" Style="float: right"
Width="12px" Height="12px" ImageUrl="~/PivotGrid/Examples/Templates/images/star.png" AlternateText="star" />
</CellTemplate>
<HeaderCellTemplate>
<asp:Label Text="Dishes sold" runat="server" />
</HeaderCellTemplate>
<ColumnGrandTotalHeaderCellTemplate>
<asp:Label Text="Total dishes sold" runat="server" />
</ColumnGrandTotalHeaderCellTemplate>
</telerik:PivotGridAggregateField>
</Fields>
<ClientSettings>
<Scrolling AllowVerticalScroll="true" ScrollHeight="600px" />
</ClientSettings>
</telerik:RadPivotGrid>
</telerik:RadAjaxPanel>
<br />
<div class="demo-container">
<label>Legend</label>
<br />
<br />
<span class="Box" id="Red"></span>
<asp:Label Text="- Displays that the product has been sold less than 40 times for the given month and is less preferred by the customers."
runat="server" />
<br />
<span class="Box" id="Green"></span>
<asp:Label ID="Label2" Text="- Displays that the product has been sold more than 110 times for the given month and is more preferred by the customers."
runat="server" />
<br />
<asp:Image ID="SoldDishesImage" runat="server" Visible="true" ImageUrl="~/PivotGrid/Examples/Templates/images/star.png" AlternateText="star" />
<asp:Label ID="Label3" Text="- Displays the top selling products which have been sold more than 30 times for the current period of the day."
runat="server" />
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [RestaurantName], [Dishes], [TimeOfDay], [Months], [NumberOfVisitors],
[SoldDishes], CAST([DishesID] AS VARCHAR) + '__' + [Dishes] as DishesData, [DishesID] FROM [Restaurants]"></asp:SqlDataSource>
</form>
</body>
</html>