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

<%@ 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 runat="server" ID="ScriptManager1">
            </asp:ScriptManager>
            <telerik:RadGrid runat="server" ID="RadGrid1" DataSourceID="SqlDataSource1" GridLines="None"
                AllowPaging="true" AutoGenerateEditColumn="true" OnItemCreated="RadGrid1_ItemCreated"
                OnItemDataBound="RadGrid1_ItemDataBound">
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID,ProductID" DataSourceID="SqlDataSource1">
                    <Columns>
                        <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" HeaderText="OrderID"
                            ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
                        </telerik:GridBoundColumn>
                        <telerik:GridDropDownColumn DataField="CategoryID" HeaderText="Category" SortExpression="CategoryID"
                            UniqueName="CategoryID" ListTextField="CategoryName" ListValueField="CategoryID">
                        </telerik:GridDropDownColumn>
                        <telerik:GridDropDownColumn DataField="ProductID" HeaderText="Product" SortExpression="ProductID"
                            UniqueName="ProductID" ListTextField="ProductName" ListValueField="ProductID">
                        </telerik:GridDropDownColumn>
                        <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" HeaderText="UnitPrice"
                            SortExpression="UnitPrice" UniqueName="UnitPrice">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Quantity" DataType="System.Int16" HeaderText="Quantity"
                            SortExpression="Quantity" UniqueName="Quantity">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Discount" DataType="System.Single" HeaderText="Discount"
                            SortExpression="Discount" UniqueName="Discount">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT d.OrderID, d.ProductID, d.UnitPrice, d.Quantity, d.Discount, p.CategoryID FROM [Order Details] AS d INNER JOIN Products AS p ON d.ProductID = p.ProductID">
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories]"></asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT [ProductID], [ProductName], [CategoryID] FROM [Products] WHERE ([CategoryID] = @CategoryID)">
                <SelectParameters>
                    <asp:Parameter Name="CategoryID" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </form>
</body>
</html>
