<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadGridNestedViewTemplate.aspx.cs"
    Inherits="RadGridNestedViewTemplate" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <telerik:RadGrid ID="RadGrid1" DataSourceID="VendorDataSource" runat="server" AutoGenerateColumns="False"
        AllowSorting="True" AllowPaging="True" PageSize="5" GridLines="None" ShowGroupPanel="True">
        <MasterTableView DataSourceID="VendorDataSource" DataKeyNames="CustomerID" AllowMultiColumnSorting="True"
            GroupLoadMode="Server">
            <ExpandCollapseColumn Visible="True">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="ContactName" HeaderText="Contact name" SortExpression="ContactName"
                    UniqueName="ContactName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="Contact title" SortExpression="ContactTitle"
                    UniqueName="ContactTitle">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Company name" SortExpression="CompanyName"
                    UniqueName="CompanyName">
                </telerik:GridBoundColumn>
            </Columns>
            <NestedViewSettings DataSourceID="VendorDetailsDataSource">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
                </ParentTableRelation>
            </NestedViewSettings>
            <NestedViewTemplate>
                <telerik:RadGrid ID="RadGrid2" AllowPaging="true" DataSourceID="VendorDetailsDataSource"
                    runat="server" GridLines="None">
                    <MasterTableView AutoGenerateColumns="false" DataKeyNames="CustomerID">
                        <Columns>
                            <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" UniqueName="OrderID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="OrderDate" HeaderText="OrderDate" UniqueName="OrderDate">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </NestedViewTemplate>
        </MasterTableView>
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <ClientSettings AllowDragToGroup="true" />
    </telerik:RadGrid>
    <asp:LinqDataSource ID="VendorDataSource" EnableObjectTracking="true" EnableUpdate="true"
        runat="server" ContextTypeName="DataClassesDataContext" TableName="Customers">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="VendorDetailsDataSource" runat="server" ContextTypeName="DataClassesDataContext"
        Where="CustomerID==@CustomerID" TableName="Orders">
        <WhereParameters>
            <asp:Parameter Name="CustomerID" Type="String" />
        </WhereParameters>
    </asp:LinqDataSource>
    </form>
</body>
</html>
