<%@ Page Language="c#" AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="_DefaultCS" %>

<%@ 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">
</head>
<body>
    <form id="mainForm" method="post" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />

    <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
        <script type="text/javascript">
            function HierarchyExpanded(sender, args)
            {
            }
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AllowMultiRowSelection="True"
        AutoGenerateColumns="False" EnableEmbeddedSkins="False" GridLines="None" ShowDesignTimeSmartTagMessage="true"
        MasterTableView-RowIndicatorColumn-Visible="true" MasterTableView-ExpandCollapseColumn-Display="false"
        ClientSettings-AllowExpandCollapse="true" SelectedItemStyle-CssClass="GridRowSelected"
        ShowHeader="false" Skin="">
        <ClientSettings ClientEvents-OnHierarchyExpanding="HierarchyExpanded" ClientEvents-OnHierarchyExpanded="HierarchyExpanded">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" />
        </ClientSettings>
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="CustomerID" AllowMultiColumnSorting="True"
            HierarchyLoadMode="Client" BorderWidth="0" GridLines="None" BorderStyle="None"
            Frame="Void" Name="MasterTable" Width="100%">
            <DetailTables>
                <telerik:GridTableView DataKeyNames="OrderID" DataSourceID="SqlDataSource2" Width="100%"
                    runat="server">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
                    </ParentTableRelation>
                    <Columns>
                        <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton"
                            DataField="OrderID" UniqueName="OrderID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" HeaderButtonType="TextButton"
                            DataField="OrderDate" UniqueName="OrderDate" DataFormatString="{0:D}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="Freight" HeaderText="Freight" HeaderButtonType="TextButton"
                            DataField="Freight" UniqueName="Freight">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="OrderDate"></telerik:GridSortExpression>
                    </SortExpressions>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"
                    DataField="CustomerID" UniqueName="CustomerID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"
                    DataField="ContactName" UniqueName="ContactName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"
                    DataField="CompanyName" UniqueName="CompanyName">
                </telerik:GridBoundColumn>
                <telerik:GridExpandColumn ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right"
                    ButtonType="ImageButton" Display="true" Visible="true"
                    ExpandImageUrl="~/images1/MoveDown.gif" UniqueName="ExpandCollapse" CollapseImageUrl="~/images1/MoveUp.gif">
                </telerik:GridExpandColumn>
            </Columns>
            <SortExpressions>
                <telerik:GridSortExpression FieldName="CompanyName"></telerik:GridSortExpression>
            </SortExpressions>
        </MasterTableView>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 5 * FROM Customers"
        runat="server"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Orders Where CustomerID = @CustomerID"
        runat="server">
        <SelectParameters>
            <asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="string" />
        </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
