Current filter:
                                You should refresh the page.

                                ASPxGridView - How to sort groups via the GroupSummarySortInfo class

                                0

                                This example demonstrates how to group ASPxGridView by cities, but sort it by countries via the GroupSummarySortInfo class.

                                This is a sample project for the ASPxGridView - How to sort groups Knowledge Base article. Please refer to it for an explanation.

                                see also:

                                ASPxGridView - How to sort groups via the CustomColumnSort event
                                ASPxGridView - How to sort groups via the GroupSummarySortInfo class and CustomSummaryCalculate event
                                ASPxGridView - How to sort grouped GridViewDataComboBoxColumn by text

                                You must  log in  or  register  to leave comments
                                Select file
                                • Default.aspx
                                • Default.aspx.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2010 vol 1.9 - v2012 vol 2.8
                                <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
                                
                                <%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
                                <%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.1, Version=10.1.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
                                <!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>
                                            <dx:ASPxGridView ID="gridCustomers" runat="server" AutoGenerateColumns="False" Width="500px"
                                                DataSourceID="dsCustomers" KeyFieldName="CustomerID">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn FieldName="CustomerID" ReadOnly="True" VisibleIndex="0">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="ContactName" VisibleIndex="1">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="City" VisibleIndex="2" GroupIndex="0">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="Region" VisibleIndex="3">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="Country" VisibleIndex="4" SortIndex="0" SortOrder="Ascending">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="CompanyName" VisibleIndex="5">
                                                    </dx:GridViewDataTextColumn>
                                                </Columns>
                                                <GroupSummary>
                                                    <dx:ASPxSummaryItem FieldName="Country" SummaryType="Min" />
                                                </GroupSummary>
                                                <Templates>
                                                    <GroupRowContent>
                                                        <%# Container.GroupText + " (" + Container.SummaryText.Split('=')[1]%>
                                                    </GroupRowContent>
                                                </Templates>
                                                <Settings ShowGroupPanel="True" />
                                            </dx:ASPxGridView>
                                            <asp:AccessDataSource ID="dsCustomers" runat="server" DataFile="~/App_Data/nwind.mdb"
                                                SelectCommand="SELECT [CustomerID], [ContactName], [City], [Region], [Country], [CompanyName] FROM [Customers]">
                                            </asp:AccessDataSource>
                                        </div>
                                    </form>
                                </body>
                                </html>