GridViewSortEventArgs.SortDirection プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > GridViewSortEventArgs.SortDirection プロパティの意味・解説 

GridViewSortEventArgs.SortDirection プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

GridView コントロール並べ替える方向取得または設定します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Property SortDirection As
 SortDirection
Dim instance As GridViewSortEventArgs
Dim value As SortDirection

value = instance.SortDirection

instance.SortDirection = value
public SortDirection SortDirection { get; set;
 }
public:
property SortDirection SortDirection {
    SortDirection get ();
    void set (SortDirection value);
}
/** @property */
public SortDirection get_SortDirection ()

/** @property */
public void set_SortDirection (SortDirection
 value)
public function get SortDirection
 () : SortDirection

public function set SortDirection
 (value : SortDirection)

プロパティ
SortDirection 値の 1 つ

解説解説
使用例使用例

SortDirection プロパティ使用してGridView コントロール並べ替える方向確認する方法次の例に示しますユーザー降順並べ替え実行しようとすると、並べ替え操作キャンセルされます。

<%@ Page language="VB" %>

<script runat="server">
  
  Sub CustomersGridView_Sorting(ByVal sender
 As Object, ByVal e As
 GridViewSortEventArgs)
  
    ' By default, the sort order toggles when the user clicks 
    ' the same sort button repeatedly. For this example, cancel
    ' the sort operation if the user attempts to sort in descending
    ' order.
    If e.SortDirection = SortDirection.Descending Then
    
      e.Cancel = True
      Message.Text = "Sorting in descending order is not supported."
    
    Else
    
      Message.Text = ""
    
    End If
      
  End Sub
  
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>GridViewSortEventArgs SortDirection Example</h3>

      <asp:label id="Message"
        forecolor="Red"
        runat="server"/>
                
      <br/>  

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        allowpaging="true"
        emptydatatext="No data available." 
        allowsorting="true"
        onsorting="CustomersGridView_Sorting"
        runat="server">
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects
  -->
      <!-- to the Northwind sample database. Use an ASP.NET
     -->
      <!-- expression to retrieve the connection string
 value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address],
 [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
        
    </form>
  </body>
</html>

<%@ Page language="C#" %>

<script runat="server">
  
  void CustomersGridView_Sorting(Object sender, GridViewSortEventArgs
 e)
  {
    // By default, the sort order toggles when the user clicks 
    // the same sort button repeatedly. For this example, cancel
    // the sort operation if the user attempts to sort in descending
    // order.
    if (e.SortDirection == SortDirection.Descending)
    {
      e.Cancel = true;
      Message.Text = "Sorting in descending order is not
 supported.";
    }
    else
    {
      Message.Text = "";
    }
  }
  
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>GridViewSortEventArgs SortDirection Example</h3>

      <asp:label id="Message"
        forecolor="Red"
        runat="server"/>
                
      <br/>  

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        allowpaging="true"
        emptydatatext="No data available." 
        allowsorting="true"
        onsorting="CustomersGridView_Sorting"
        runat="server">
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value
   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City],
 [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
        
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GridViewSortEventArgs クラス
GridViewSortEventArgs メンバ
System.Web.UI.WebControls 名前空間
GridView.AllowSorting プロパティ
GridView.SortDirection プロパティ
SortExpression



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「GridViewSortEventArgs.SortDirection プロパティ」の関連用語

GridViewSortEventArgs.SortDirection プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



GridViewSortEventArgs.SortDirection プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS