<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ 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">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
         <telerik:RadGrid runat="server" ID="RadGrid1" 
                AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" 
                    DataSourceID="SqlDataSource1" 
                    GridLines="None" Skin="Telerik" ShowGroupPanel="true">
                <MasterTableView DataKeyNames="CustomerID" 
                    DataSourceID="SqlDataSource1" AutoGenerateColumns="false">           
                    <Columns>                        
                        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID"
                            ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName"
                            SortExpression="CompanyName" UniqueName="CompanyName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactName" HeaderText="ContactName"
                            SortExpression="ContactName" UniqueName="ContactName">
                        </telerik:GridBoundColumn>                       
                        <telerik:GridTemplateColumn UniqueName="GridTemplateColumn1" 
                            DataField="ContactTitle" HeaderText="ContactTitle" 
                            GroupByExpression="ContactTitle Group By ContactTitle">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="Label1" Text='<%#Eval("ContactTitle") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>      
                    <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldName="ContactTitle" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="ContactTitle" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>             
                </MasterTableView>  
                <ClientSettings AllowDragToGroup="true">
                </ClientSettings>                                 
            </telerik:RadGrid>
            
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]">
            </asp:SqlDataSource>           
            
    </div>
    </form>
</body>
</html>
