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

<!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:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" PageSize="5" DataSourceID="SqlDataSource1"
        GridLines="None" Width="95%" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True"
        CellSpacing="0" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">
        <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
        <MasterTableView DataKeyNames="CustomerID" AutoGenerateColumns="False">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="CustomerID" FilterControlAltText="Filter CustomerID column"
                    HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CompanyName" FilterControlAltText="Filter CompanyName column"
                    HeaderText="CompanyName" SortExpression="CompanyName" UniqueName="CompanyName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ContactName" FilterControlAltText="Filter ContactName column"
                    HeaderText="ContactName" SortExpression="ContactName" UniqueName="ContactName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ContactTitle" FilterControlAltText="Filter ContactTitle column"
                    HeaderText="ContactTitle" SortExpression="ContactTitle" UniqueName="ContactTitle">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Address" FilterControlAltText="Filter Address column"
                    HeaderText="Address" SortExpression="Address" UniqueName="Address">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PostalCode" FilterControlAltText="Filter PostalCode column"
                    HeaderText="PostalCode" SortExpression="PostalCode" UniqueName="PostalCode">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <PagerStyle Mode="NextPrevAndNumeric" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    <br />
    <br />
    <strong>Orders:</strong>
    <telerik:RadGrid ID="RadGrid2" ShowStatusBar="True" runat="server" AllowPaging="True"
        PageSize="5" DataSourceID="SqlDataSource2" GridLines="None" Width="95%" AutoGenerateDeleteColumn="True"
        AutoGenerateEditColumn="True" CellSpacing="0" AllowAutomaticDeletes="true" AllowAutomaticInserts="true"
        AllowAutomaticUpdates="true">
        <MasterTableView Width="100%" AutoGenerateColumns="False" DataKeyNames="OrderID"
            DataSourceID="SqlDataSource2">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" HeaderText="OrderID"
                    ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="OrderDate" DataType="System.DateTime" HeaderText="OrderDate"
                    SortExpression="OrderDate" UniqueName="OrderDate">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
                    UniqueName="CustomerID" FilterControlAltText="Filter CustomerID column">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ShipCountry" FilterControlAltText="Filter ShipCountry column"
                    HeaderText="ShipCountry" SortExpression="ShipCountry" UniqueName="ShipCountry">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
        <PagerStyle Mode="NextPrevAndNumeric" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    <br />
    <br />
    <strong>Orders details:</strong>
    <telerik:RadGrid ID="RadGrid3" ShowStatusBar="True" runat="server" AllowPaging="True"
        PageSize="5" DataSourceID="SqlDataSource3" GridLines="None" Width="95%" AutoGenerateDeleteColumn="True"
        AutoGenerateEditColumn="True" CellSpacing="0" AllowAutomaticDeletes="true" AllowAutomaticInserts="true"
        AllowAutomaticUpdates="true">
        <MasterTableView Width="100%" AutoGenerateColumns="False" DataKeyNames="OrderID,ProductID"
            DataSourceID="SqlDataSource3">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" SortExpression="OrderID"
                    UniqueName="OrderID" DataType="System.Int32" FilterControlAltText="Filter OrderID column"
                    ReadOnly="True">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice"
                    UniqueName="UnitPrice" DataType="System.Decimal" FilterControlAltText="Filter UnitPrice column">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity"
                    UniqueName="Quantity" DataType="System.Int16" FilterControlAltText="Filter Quantity column">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Discount" DataType="System.Single" FilterControlAltText="Filter Discount column"
                    HeaderText="Discount" SortExpression="Discount" UniqueName="Discount">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProductID" DataType="System.Int32" FilterControlAltText="Filter ProductID column"
                    HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <PagerStyle Mode="NextPrevAndNumeric" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [PostalCode] FROM [Customers]"
        runat="server" ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [Customers] WHERE [CustomerID] = @original_CustomerID AND [CompanyName] = @original_CompanyName AND (([ContactName] = @original_ContactName) OR ([ContactName] IS NULL AND @original_ContactName IS NULL)) AND (([ContactTitle] = @original_ContactTitle) OR ([ContactTitle] IS NULL AND @original_ContactTitle IS NULL)) AND (([Address] = @original_Address) OR ([Address] IS NULL AND @original_Address IS NULL)) AND (([PostalCode] = @original_PostalCode) OR ([PostalCode] IS NULL AND @original_PostalCode IS NULL))"
        InsertCommand="INSERT INTO [Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [PostalCode]) VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle, @Address, @PostalCode)"
        OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [Customers] SET [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, [Address] = @Address, [PostalCode] = @PostalCode WHERE [CustomerID] = @original_CustomerID AND [CompanyName] = @original_CompanyName AND (([ContactName] = @original_ContactName) OR ([ContactName] IS NULL AND @original_ContactName IS NULL)) AND (([ContactTitle] = @original_ContactTitle) OR ([ContactTitle] IS NULL AND @original_ContactTitle IS NULL)) AND (([Address] = @original_Address) OR ([Address] IS NULL AND @original_Address IS NULL)) AND (([PostalCode] = @original_PostalCode) OR ([PostalCode] IS NULL AND @original_PostalCode IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_CustomerID" Type="String" />
            <asp:Parameter Name="original_CompanyName" Type="String" />
            <asp:Parameter Name="original_ContactName" Type="String" />
            <asp:Parameter Name="original_ContactTitle" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_PostalCode" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="CustomerID" Type="String" />
            <asp:Parameter Name="CompanyName" Type="String" />
            <asp:Parameter Name="ContactName" Type="String" />
            <asp:Parameter Name="ContactTitle" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="CompanyName" Type="String" />
            <asp:Parameter Name="ContactName" Type="String" />
            <asp:Parameter Name="ContactTitle" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
            <asp:Parameter Name="original_CustomerID" Type="String" />
            <asp:Parameter Name="original_CompanyName" Type="String" />
            <asp:Parameter Name="original_ContactName" Type="String" />
            <asp:Parameter Name="original_ContactTitle" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_PostalCode" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [OrderID], [OrderDate], [CustomerID], [ShipCountry] FROM [Orders] WHERE ([CustomerID] = @CustomerID)"
        runat="server" ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [Orders] WHERE [OrderID] = @original_OrderID AND (([OrderDate] = @original_OrderDate) OR ([OrderDate] IS NULL AND @original_OrderDate IS NULL)) AND (([CustomerID] = @original_CustomerID) OR ([CustomerID] IS NULL AND @original_CustomerID IS NULL)) AND (([ShipCountry] = @original_ShipCountry) OR ([ShipCountry] IS NULL AND @original_ShipCountry IS NULL))"
        InsertCommand="INSERT INTO [Orders] ([OrderDate], [CustomerID], [ShipCountry]) VALUES (@OrderDate, @CustomerID, @ShipCountry)"
        OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [Orders] SET [OrderDate] = @OrderDate, [CustomerID] = @CustomerID, [ShipCountry] = @ShipCountry WHERE [OrderID] = @original_OrderID AND (([OrderDate] = @original_OrderDate) OR ([OrderDate] IS NULL AND @original_OrderDate IS NULL)) AND (([CustomerID] = @original_CustomerID) OR ([CustomerID] IS NULL AND @original_CustomerID IS NULL)) AND (([ShipCountry] = @original_ShipCountry) OR ([ShipCountry] IS NULL AND @original_ShipCountry IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_OrderID" Type="Int32" />
            <asp:Parameter Name="original_OrderDate" Type="DateTime" />
            <asp:Parameter Name="original_CustomerID" Type="String" />
            <asp:Parameter Name="original_ShipCountry" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="OrderDate" Type="DateTime" />
            <asp:Parameter Name="CustomerID" Type="String" />
            <asp:Parameter Name="ShipCountry" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="OrderDate" Type="DateTime" />
            <asp:Parameter Name="CustomerID" Type="String" />
            <asp:Parameter Name="ShipCountry" Type="String" />
            <asp:Parameter Name="original_OrderID" Type="Int32" />
            <asp:Parameter Name="original_OrderDate" Type="DateTime" />
            <asp:Parameter Name="original_CustomerID" Type="String" />
            <asp:Parameter Name="original_ShipCountry" Type="String" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="RadGrid1" DefaultValue="ALFKI" Name="CustomerID"
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [OrderID], [UnitPrice], [Quantity], [Discount], [ProductID] FROM [Order Details] WHERE ([OrderID] = @OrderID)"
        runat="server" ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [Order Details] WHERE [OrderID] = @original_OrderID AND [ProductID] = @original_ProductID AND [UnitPrice] = @original_UnitPrice AND [Quantity] = @original_Quantity AND [Discount] = @original_Discount"
        InsertCommand="INSERT INTO [Order Details] ([OrderID], [UnitPrice], [Quantity], [Discount], [ProductID]) VALUES (@OrderID, @UnitPrice, @Quantity, @Discount, @ProductID)"
        OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [Order Details] SET [UnitPrice] = @UnitPrice, [Quantity] = @Quantity, [Discount] = @Discount WHERE [OrderID] = @original_OrderID AND [ProductID] = @original_ProductID AND [UnitPrice] = @original_UnitPrice AND [Quantity] = @original_Quantity AND [Discount] = @original_Discount">
        <DeleteParameters>
            <asp:Parameter Name="original_OrderID" Type="Int32" />
            <asp:Parameter Name="original_ProductID" Type="Int32" />
            <asp:Parameter Name="original_UnitPrice" Type="Decimal" />
            <asp:Parameter Name="original_Quantity" Type="Int16" />
            <asp:Parameter Name="original_Discount" Type="Single" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="OrderID" Type="Int32" />
            <asp:Parameter Name="UnitPrice" Type="Decimal" />
            <asp:Parameter Name="Quantity" Type="Int16" />
            <asp:Parameter Name="Discount" Type="Single" />
            <asp:Parameter Name="ProductID" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="UnitPrice" Type="Decimal" />
            <asp:Parameter Name="Quantity" Type="Int16" />
            <asp:Parameter Name="Discount" Type="Single" />
            <asp:Parameter Name="original_OrderID" Type="Int32" />
            <asp:Parameter Name="original_ProductID" Type="Int32" />
            <asp:Parameter Name="original_UnitPrice" Type="Decimal" />
            <asp:Parameter Name="original_Quantity" Type="Int16" />
            <asp:Parameter Name="original_Discount" Type="Single" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="RadGrid2" Name="OrderID" DefaultValue="10643" PropertyName="SelectedValues['OrderID']"
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
