<%@ Page EnableViewState="false" Language="C#" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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>Two level hierarchy</title>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

        <script type="text/javascript" src="Script1.js"></script>

        <script type="text/javascript">
            function pageLoad(sender, args) {
                tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

                commandName = "Load"

                WebService.GetCustomers(0, tableView.get_pageSize(),
                    tableView.get_sortExpressions().toString(), tableView.get_filterExpressions().toDynamicLinq(),
                        updateGrid);
            }
        </script>

    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Services>
                <asp:ServiceReference Path="~/WebService.asmx" />
            </Services>
        </telerik:RadScriptManager>
        <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
        <telerik:RadGrid ID="RadGrid1" AllowFilteringByColumn="true" Skin="Telerik" runat="server"
            GridLines="None" AllowPaging="true" AllowSorting="true" PageSize="3">
            <ClientSettings>
                <ClientEvents OnCommand="RadGrid1_Command" OnHierarchyExpanding="RadGrid1_HierarchyExpanding" />
            </ClientSettings>
            <MasterTableView HierarchyLoadMode="Client" ClientDataKeyNames="CustomerID">
                <Columns>
                    <telerik:GridBoundColumn SortExpression="CustomerID" DataField="CustomerID" HeaderText="CustomerID" />
                    <telerik:GridBoundColumn SortExpression="CompanyName" DataField="CompanyName" HeaderText="CompanyName" />
                    <telerik:GridBoundColumn SortExpression="ContactName" DataField="ContactName" HeaderText="ContactName" />
                    <telerik:GridBoundColumn SortExpression="ContactTitle" DataField="ContactTitle" HeaderText="ContactTitle" />
                    <telerik:GridBoundColumn SortExpression="Country" DataField="Country" HeaderText="Country" />
                    <telerik:GridBoundColumn SortExpression="City" DataField="City" HeaderText="City" />
                </Columns>
                <NestedViewTemplate>
                </NestedViewTemplate>
            </MasterTableView>
            <PagerStyle AlwaysVisible="true" />
        </telerik:RadGrid>
        <telerik:RadGrid ID="RadGrid2" AllowFilteringByColumn="true" Skin="Telerik" runat="server"
            GridLines="None" AllowPaging="true" AllowSorting="true" PageSize="3" style="display:none">
            <ClientSettings>
                <ClientEvents OnCommand="RadGrid2_Command" />
            </ClientSettings>
            <MasterTableView ClientDataKeyNames="OrderID">
                <Columns>
                    <telerik:GridBoundColumn SortExpression="OrderID" DataField="OrderID" HeaderText="OrderID"
                        DataType="System.Int32" />
                    <telerik:GridBoundColumn SortExpression="OrderDate" DataField="OrderDate" HeaderText="OrderDate"
                        DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}" />
                    <telerik:GridBoundColumn SortExpression="ShipName" DataField="ShipName" HeaderText="ShipName" />
                    <telerik:GridBoundColumn SortExpression="ShipCity" DataField="ShipCity" HeaderText="ShipCity" />
                    <telerik:GridBoundColumn SortExpression="ShipCountry" DataField="ShipCountry" HeaderText="ShipCountry" />
                </Columns>
            </MasterTableView>
            <PagerStyle AlwaysVisible="true" />
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
