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

<%@ 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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadGrid2">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid2" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT [ProductName], [UnitPrice], [UnitsInStock], [UnitsOnOrder] FROM [Alphabetical list of products]">
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice], [UnitsInStock], [UnitsOnOrder] FROM [Products]">
            </asp:SqlDataSource>
            <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />
            <telerik:RadGrid ID="RadGrid2" ShowGroupPanel="true" runat="server" AllowPaging="True"
                AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                GridLines="None" Skin="Mac" OnDataBound="RadGrid2_DataBound">
                <MasterTableView DataSourceID="SqlDataSource2" DataKeyNames="ProductID">
                    <Columns>
                        <telerik:GridBoundColumn DataField="ProductID" DataType="System.Decimal" HeaderText="ProductID"
                            SortExpression="ProductID" UniqueName="ProductID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName"
                            UniqueName="ProductName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" HeaderText="UnitPrice"
                            SortExpression="UnitPrice" UniqueName="UnitPrice">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="UnitsInStock" DataType="System.Int16" HeaderText="UnitsInStock"
                            SortExpression="UnitsInStock" UniqueName="UnitsInStock">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="UnitsOnOrder" DataType="System.Int16" HeaderText="UnitsOnOrder"
                            SortExpression="UnitsOnOrder" UniqueName="UnitsOnOrder">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <DetailTables>
                        <telerik:GridTableView Name="OrderDetails" DataSourceID="SqlDataSource3" DataKeyNames="OrderID, ProductID">
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="ProductID" MasterKeyField="ProductID" />
                            </ParentTableRelation>
                            <Columns>
                                <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" SortExpression="OrderID"
                                    UniqueName="OrderID">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ProductID" DataType="System.Decimal" HeaderText="ProductID"
                                    SortExpression="ProductID" UniqueName="ProductID">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Quantity" DataType="System.Int16" HeaderText="Quantity"
                                    SortExpression="Quantity" UniqueName="Quantity">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                </MasterTableView>
                <ClientSettings AllowDragToGroup="true">
                </ClientSettings>
                <PagerStyle Mode="NextPrevAndNumeric" />
            </telerik:RadGrid>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="Data Source=KOVACHEV\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
                ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [Order Details] WHERE ProductID=@ProductID">
                <SelectParameters>
                    <asp:SessionParameter Name="ProductID" SessionField="ProductID" Type="int32" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </form>
</body>
</html>
