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

Dim instance As DataControlField Dim value As String value = instance.SortExpression instance.SortExpression = value
/** @property */ public String get_SortExpression () /** @property */ public void set_SortExpression (String value)
データ ソース コントロールでデータを並べ替えるために使用される並べ替え式。既定値は空の文字列 ("") です。


SortExpression プロパティを使用してデータ コントロール フィールドに並べ替え式を割り当てる方法を次のコード例に示します。
<%@ page language="VB" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="Select * From Employees"> </asp:sqldatasource> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" height="208px" width="264px" autogeneraterows="False"> <fields> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> <itemstyle backcolor="Yellow"> </itemstyle> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> <itemstyle forecolor="#C00000"> </itemstyle> </asp:boundfield> <asp:buttonfield text="TestButton" buttontype="Button"> </asp:buttonfield> </fields> </asp:detailsview> </form> </body> </html>
<%@ page language="C#" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="Select * From Employees"> </asp:sqldatasource> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" height="208px" width="264px" autogeneraterows="False"> <fields> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> <itemstyle backcolor="Yellow"> </itemstyle> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> <itemstyle forecolor="#C00000"> </itemstyle> </asp:boundfield> <asp:buttonfield text="TestButton" buttontype="Button"> </asp:buttonfield> </fields> </asp:detailsview> </form> </body> </html>
<%@ page language="VJ#" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;" selectcommand="Select * From Employees"> </asp:sqldatasource> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" height="208px" width="264px" autogeneraterows="False"> <fields> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> <itemstyle backcolor="Yellow"> </itemstyle> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> <itemstyle forecolor="#C00000"> </itemstyle> </asp:boundfield> <asp:buttonfield text="TestButton" buttontype="Button"> </asp:buttonfield> </fields> </asp:detailsview> </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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- DataControlField.SortExpression プロパティのページへのリンク