<%@ Page Language="c#" %>
<%@ 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>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>
<div class="demo-container no-bg">
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" ShowGroupPanel="true" AllowSorting="true"
DataSourceID="SqlDataSource1" AllowPaging="true" PageSize="30" AutoGenerateColumns="false" Width="100%">
<ClientSettings AllowColumnsReorder="true" AllowDragToGroup="true" ReorderColumnsOnClient="true">
<Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
<Resizing AllowColumnResize="true" EnableRealTimeResize="true" />
</ClientSettings>
<GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
<MasterTableView EnableHeaderContextMenu="true">
<ColumnGroups>
<telerik:GridColumnGroup HeaderText="Product Details" Name="ProductDetails" HeaderStyle-HorizontalAlign="Center">
</telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Location" Name="Location">
</telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Category" Name="Category" ParentGroupName="ProductDetails">
</telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Order Details" Name="OrderDetails" ParentGroupName="ProductDetails"
HeaderStyle-HorizontalAlign="Center">
</telerik:GridColumnGroup>
</ColumnGroups>
<Columns>
<telerik:GridBoundColumn UniqueName="SupplierName" DataField="SupplierName" HeaderText="Supplier Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Address" DataField="Address" ColumnGroupName="Location"
HeaderText="Address">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="City" DataField="City" ColumnGroupName="Location"
HeaderText="City">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn UniqueName="ID" DataField="ID" ColumnGroupName="Category"
HeaderText="ID">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn UniqueName="CategoryName" DataField="CategoryName" ColumnGroupName="Category"
HeaderText="Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="ProductName" DataField="ProductName" ColumnGroupName="ProductDetails"
HeaderText="Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="Quantity" DataField="Quantity" ColumnGroupName="ProductDetails"
HeaderText="Quantity">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn UniqueName="Freight" DataField="Freight" ColumnGroupName="OrderDetails"
HeaderText="Freight">
</telerik:GridNumericColumn>
<telerik:GridDateTimeColumn UniqueName="OrderDate" DataField="OrderDate" ColumnGroupName="OrderDetails"
HeaderText="Date">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn UniqueName="OrderAddress" DataField="OrderAddress" ColumnGroupName="OrderDetails"
HeaderText="Address">
</telerik:GridBoundColumn>
<telerik:GridNumericColumn UniqueName="Price" DataField="Price" ColumnGroupName="ProductDetails"
HeaderText="Price">
</telerik:GridNumericColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT pdc.ProductID as ProductID, s.CompanyName as SupplierName, pdc.CategoryID as ID, pdc.CategoryName as CategoryName,
pdc.ProductName as ProductName, pdc.QuantityPerUnit as Quantity, o.Freight as Freight, o.OrderDate as OrderDate,
o.ShipAddress as OrderAddress, pdc.UnitPrice as Price, s.City as City, s.Address as Address
FROM Suppliers s
INNER JOIN (SELECT p.ProductID as ProductID, p.SupplierID as SupplierID, p.ProductName as ProductName,
p.QuantityPerUnit as QuantityPerUnit, p.UnitPrice as UnitPrice, od.OrderID as OrderID, c.CategoryID as CategoryID, c.CategoryName as CategoryName
FROM Products p
INNER JOIN [Order Details] od ON p.ProductID = od.ProductID INNER JOIN Categories c on c.CategoryID=p.CategoryID
WHERE od.OrderID in
(SELECT TOP(3) od1.OrderID
FROM [Order Details] od1
WHERE od1.ProductID=od.ProductID)
) pdc on pdc.SupplierID=s.SupplierID
INNER JOIN Orders o on o.OrderID=pdc.OrderID
ORDER BY pdc.ProductID"
runat="server"></asp:SqlDataSource>
</form>
</body>
</html>