<%@ 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.
        var selected = new Array();
        function RadGrid1_RowSelected(sender, args) {
            var OrderID = args.getDataKeyValue("OrderID");
            if (!selected[OrderID]) {
                selected[OrderID] = true;
            }
        }
        function RadGrid1_RowDeselected(sender, args) {
            var OrderID = args.getDataKeyValue("OrderID");
            if (selected[OrderID]) {
                selected[OrderID] = null;
            }
        }
        function RadGrid1_RowCreated(sender, args) {
            var OrderID = args.getDataKeyValue("OrderID");
            if (selected[OrderID]) {
                args.get_gridDataItem().set_selected(true);
            }
        }
        function RadGrid1_OnCommand(sender, args) {
            selected = [];
        }
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0"
        DataSourceID="SqlDataSource1" GridLines="None" Width="600px" ShowFooter="True"
        AllowMultiRowSelection="True" OnCustomAggregate="RadGrid1_CustomAggregate" OnItemCommand="RadGrid1_ItemCommand">
        <ClientSettings EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
            <ClientEvents OnRowCreated="RadGrid1_RowCreated" OnRowSelected="RadGrid1_RowSelected"
                OnRowDeselected="RadGrid1_RowDeselected" OnCommand="RadGrid1_OnCommand" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID" DataSourceID="SqlDataSource1"
            OnDataBinding="MasterTableView_DataBinding" ClientDataKeyNames="OrderID">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridClientSelectColumn>
                </telerik:GridClientSelectColumn>
                <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" FilterControlAltText="Filter OrderID column"
                    HeaderText="OrderID" ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID"
                    Aggregate="Count">
                </telerik:GridBoundColumn>
                <telerik:GridNumericColumn DataField="Freight" DataType="System.Decimal" FilterControlAltText="Filter Freight column"
                    HeaderText="Freight" SortExpression="Freight" UniqueName="Freight" Aggregate="Custom">
                </telerik:GridNumericColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT TOP 50 [OrderID], [Freight] FROM [Orders]"></asp:SqlDataSource>
    </form>
</body>
</html>
