いろいろ備忘録日記

主に .NET とか Go とか Flutter とか Python絡みのメモを公開しています。

DevExpress奮闘記-081 (ソート列を複数設定)(ASPxGridView, Shiftキー, クリック)

以下、ちょっとしたTipsです。


ASPxGridViewで、実行時に以下のようにすると
複数のソート列を設定することができます。

SHIFTキーを押しながら、列をクリック


以下サンプルです。
まず、ソート列無しの状態で表示.

左端の列をクリック

SHIFTキーを押しながら、2番目の列をクリック


以下、上記サンプルのaspxファイルです。
コードビハインド側は何も記述していないので割愛します。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DevExpress_ASPxGridView_ソート列の複数設定.Default" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
             Namespace="DevExpress.Web.ASPxGridView" 
             TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.4.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>ASPxGridView Samples</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>    
            <h5>[Shiftキーを押しながら列をクリックすると、ソート列を複数設定出来ます]</h5>
        </div>
        <dx:ASPxGridView ID="ASPxGridView1" 
                         runat="server" 
                         AutoGenerateColumns="False" 
                         DataSourceID="SqlDataSource1">
            <Columns>
                <dx:GridViewDataTextColumn FieldName="CategoryName" VisibleIndex="0">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="QuantityPerUnit" VisibleIndex="2">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="UnitsInStock" VisibleIndex="3">
                </dx:GridViewDataTextColumn>
            </Columns>
        </dx:ASPxGridView>
        <asp:SqlDataSource ID="SqlDataSource1" 
                           runat="server" 
                           ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
                           SelectCommand="SELECT [CategoryName], [ProductName], [QuantityPerUnit], [UnitsInStock] FROM [Products by Category]">
        </asp:SqlDataSource>
    </form>
</body>
</html>


================================
過去の記事については、以下のページからご参照下さい。