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

<%@ 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>Untitled Page</title>
    <style type="text/css">
    
   
    
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1">
        </asp:ScriptManager>
        <br />

        <script type="text/javascript">
                
              
        
        </script>

        <telerik:RadGrid ID="RadGrid1" Skin="WebBlue" DataSourceID="SqlDataSource1" runat="server"
            Width="95%" AutoGenerateColumns="False" PageSize="3" AllowSorting="True" AllowMultiRowSelection="False"
            AllowPaging="True" GridLines="None" ShowStatusBar="true">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <ClientSettings AllowExpandCollapse="True">
            </ClientSettings>
            <MasterTableView EditMode="PopUp" DataSourceID="SqlDataSource1" DataKeyNames="CustomerID"
                AllowMultiColumnSorting="True" HierarchyLoadMode="Client" Width="100%">
                <EditFormSettings PopUpSettings-Width="780px" EditFormType="Template" PopUpSettings-Modal="true">
                    <FormTemplate>
                        <asp:Button ID="Button1" Text="Update" runat="server" CommandName="Update"></asp:Button>&nbsp;&nbsp;
                        <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                        </asp:Button>
                        <br />
                    </FormTemplate>
                </EditFormSettings>
                <DetailTables>
                    <telerik:GridTableView EditMode="PopUp" DataKeyNames="OrderID" DataSourceID="SqlDataSource2" Width="100%">
                        <EditFormSettings PopUpSettings-Width="780px" EditFormType="Template" PopUpSettings-Modal="true">
                            <FormTemplate>
                                <asp:Button ID="Button1" Text="Update" runat="server" CommandName="Update"></asp:Button>&nbsp;&nbsp;
                                <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                </asp:Button>
                                <br />
                            </FormTemplate>
                        </EditFormSettings>
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
                        </ParentTableRelation>
                        <DetailTables>
                            <telerik:GridTableView EditMode="PopUp" DataKeyNames="OrderID" DataSourceID="SqlDataSource3"
                                Width="100%">
                                <EditFormSettings PopUpSettings-Width="780px" EditFormType="Template" PopUpSettings-Modal="true">
                                    <FormTemplate>
                                        <asp:Button ID="Button1" Text="Update" runat="server" CommandName="Update"></asp:Button>&nbsp;&nbsp;
                                        <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                        </asp:Button>
                                        <br />
                                    </FormTemplate>
                                </EditFormSettings>
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="OrderID" MasterKeyField="OrderID" />
                                </ParentTableRelation>
                                <Columns>
                                    <telerik:GridEditCommandColumn>
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridBoundColumn SortExpression="UnitPrice" HeaderText="Unit Price" HeaderButtonType="TextButton"
                                        DataField="UnitPrice">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Quantity" HeaderText="Quantity" HeaderButtonType="TextButton"
                                        DataField="Quantity">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Discount" HeaderText="Discount" HeaderButtonType="TextButton"
                                        DataField="Discount">
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <SortExpressions>
                                    <telerik:GridSortExpression FieldName="Quantity" SortOrder="Descending"></telerik:GridSortExpression>
                                </SortExpressions>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>
                            <telerik:GridEditCommandColumn>
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton"
                                DataField="OrderID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" HeaderButtonType="TextButton"
                                DataField="OrderDate">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton"
                                DataField="EmployeeID">
                            </telerik:GridBoundColumn>
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="OrderDate"></telerik:GridSortExpression>
                        </SortExpressions>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"
                        DataField="CustomerID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"
                        DataField="ContactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"
                        DataField="CompanyName">
                    </telerik:GridBoundColumn>
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="CompanyName"></telerik:GridSortExpression>
                </SortExpressions>
            </MasterTableView>
        </telerik:RadGrid>
        <asp:AccessDataSource ID="SqlDataSource1" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT * FROM Customers"
            runat="server"></asp:AccessDataSource>
        <asp:AccessDataSource ID="SqlDataSource2" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT * FROM Orders Where CustomerID = ?"
            runat="server">
            <SelectParameters>
                <asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="string" />
            </SelectParameters>
        </asp:AccessDataSource>
        <asp:AccessDataSource ID="SqlDataSource3" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT * FROM [Order Details] where OrderID = ?"
            runat="server">
            <SelectParameters>
                <asp:SessionParameter Name="OrderID" SessionField="OrderID" Type="Int32" />
            </SelectParameters>
        </asp:AccessDataSource>
        <br />
    </form>
</body>
</html>
