<%@ 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></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ShowGroupPanel="True" AutoGenerateColumns="False" ID="RadGrid1"
            DataSourceID="AccessDataSource1" AllowFilteringByColumn="True" AllowSorting="True"
            ShowFooter="True" runat="server" GridLines="None" AllowPaging="True">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true">
                <Columns>
                    <telerik:GridBoundColumn Aggregate="Count" DataField="ProductID" HeaderText="Product ID"
                        FooterText="Total products: ">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ProductName" HeaderText="Product name" SortExpression="ProductName"
                        UniqueName="ProductName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="UnitPrice" HeaderText="Unit price"
                        FooterText="Total price: " FooterAggregateFormatString="{0:0}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="UnitsInStock" HeaderText="Units in stock"
                        FooterText="All units in stock: ">
                    </telerik:GridBoundColumn>
                    <telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice" DataType="System.Double"
                        DataFields="UnitPrice, UnitsInStock" Expression="{0}*{1}" DataFormatString="{0:0}"
                        FooterText="Avg : " Aggregate="Avg" />
                </Columns>
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="UnitPrice" />
                        </GroupByFields>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="UnitPrice" HeaderText="Unit price" />
                        </SelectFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>
            </MasterTableView>
            <ClientSettings AllowDragToGroup="true" />
        </telerik:RadGrid>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb"
            SelectCommand="SELECT * FROM Products Where UnitPrice > 9.50"></asp:AccessDataSource>
        <asp:Button ID="Button1" Text="PostBack!" CssClass="button" Style="margin: 10px 22px 10px 0px"
            runat="server"></asp:Button>
        Click PostBack to see the state of the grid is preserved.
        <%-- <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT * FROM Products Where UnitPrice > 9.50" runat="server"></asp:SqlDataSource>--%>
    </div>
    </form>
</body>
</html>
