ListViewSortEventArgs.SortDirection Property
.NET Framework (current version)
Gets or sets the direction in which to sort the ListView control.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
The following example shows how to use the ListViewSortEventArgs object to display the sort direction and the column being sorted. This code example is part of a larger example provided for the ListViewSortEventArgs class.
Sub ContactsListView_Sorting(ByVal sender As Object, ByVal e As ListViewSortEventArgs) ' Check the sort direction to set the image URL accordingly. Dim imgUrl As String If e.SortDirection = SortDirection.Ascending Then imgUrl = "~/images/ascending.gif" Else imgUrl = "~/images/descending.gif" End If ' Check which field is being sorted ' to set the visibility of the image controls. Dim sortImage1 As Image = CType(ContactsListView.FindControl("SortImage1"), Image) Dim sortImage2 As Image = CType(ContactsListView.FindControl("SortImage2"), Image) Dim sortImage3 As Image = CType(ContactsListView.FindControl("SortImage3"), Image) Select Case e.SortExpression Case "FirstName" sortImage1.Visible = True sortImage1.ImageUrl = imgUrl sortImage2.Visible = False sortImage3.Visible = False Case "LastName" sortImage1.Visible = False sortImage2.Visible = True sortImage2.ImageUrl = imgUrl sortImage3.Visible = False Case "EmailAddress" sortImage1.Visible = False sortImage2.Visible = False sortImage3.Visible = True sortImage3.ImageUrl = imgUrl End Select End Sub
.NET Framework
Available since 3.5
Available since 3.5
Show: