GridViewSortEventArgs.SortDirection プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As GridViewSortEventArgs Dim value As SortDirection value = instance.SortDirection instance.SortDirection = value
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 つ。

Sorting イベントが発生した場合に、SortDirection プロパティを使用して、並べ替え操作の実行時に GridView コントロールが (並べ替え式に基づいて) 項目を並べ替える順序を確認できます。並べ替え操作の前に Sorting イベントが発生するため、SortDirection プロパティを使用して、プログラムによって並べ替えの方向を設定することもできます。

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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からGridViewSortEventArgs.SortDirection プロパティを検索する場合は、下記のリンクをクリックしてください。

- GridViewSortEventArgs.SortDirection プロパティのページへのリンク