<%@ Page 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></title>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

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

        <script type="text/javascript">
            function pageLoad() {
                customersTableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                ordersTableView = $find("<%= RadGrid2.ClientID %>").get_masterTableView();

                customersCommandName = "Load";

                WebService.GetCustomers(0, customersTableView.get_pageSize(),
                    customersTableView.get_sortExpressions().toString(), 
                        customersTableView.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" />
        <b>Customers:</b>
        <telerik:RadGrid ID="RadGrid1" Skin="Sunset" runat="server" AllowPaging="true" AllowSorting="True"
            AllowFilteringByColumn="true" GridLines="None" PageSize="5">
            <ItemStyle Wrap="false" />
            <MasterTableView ClientDataKeyNames="CustomerID" AllowMultiColumnSorting="true">
                <Columns>
                    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" />
                    <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" />
                    <telerik:GridBoundColumn DataField="ContactName" HeaderText="ContactName" />
                    <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" />
                    <telerik:GridBoundColumn DataField="Country" HeaderText="Country" />
                    <telerik:GridBoundColumn DataField="City" HeaderText="City" />
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnCommand="RadGrid1_Command" OnRowSelected="RadGrid1_RowSelected" />
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
        </telerik:RadGrid>
        <br />
        <b>Orders:</b>
        <telerik:RadGrid ID="RadGrid2" Skin="Sunset" runat="server" AllowPaging="true" AllowSorting="True"
            AllowFilteringByColumn="true" GridLines="None" PageSize="5">
            <ItemStyle Wrap="false" />
            <MasterTableView AllowMultiColumnSorting="true">
                <Columns>
                    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" />
                    <telerik:GridBoundColumn DataType="System.Int32" DataField="OrderID" HeaderText="OrderID" />
                    <telerik:GridBoundColumn DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}"
                        DataField="OrderDate" HeaderText="OrderDate" />
                    <telerik:GridBoundColumn DataField="ShipVia" HeaderText="ShipVia" DataType="System.Int32" />
                    <telerik:GridBoundColumn DataType="System.Decimal" DataField="Freight" HeaderText="Freight" />
                    <telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName" />
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnCommand="RadGrid2_Command" />
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
