Sub dgrdCustomers_SortCommand(s As Object, e As DataGridSortCommandEventArgs)
If SortExpression <> e.SortExpression Then
SortExpression = e.SortExpression
SortDirection = "asc"
Else
If SortDirection = "asc" Then
SortDirection = "desc"
Else
SortDirection = "asc"
End If
End If
BindDataGrid()
End Sub
Property SortExpression() As String
Get
Dim obj As Object = ViewState("SortExpression")
If obj Is Nothing Then
Return String.Empty
End If
Return CType(obj, String)
End Get
Set(ByVal Value As String)
ViewState("SortExpression") = Value
End Set
End Property
Property SortDirection() As String
Get
Dim obj As Object = ViewState("SortDirection")
If obj Is Nothing Then
Return String.Empty
End If
Return CType(obj, String)
End Get
Set(ByVal Value As String)
ViewState("SortDirection") = Value
End Set
End Property
|