Property SortField_Terr() As String
' SortField property is tracked in ViewState for both the
' TerritoryGrid and the EmployeeTerritoryGrid
Get
Dim o As Object = ViewState("SortField_Terr")
If o Is Nothing Then
Return [String].Empty
End If
Return CStr(o)
End Get
Set(ByVal Value As String)
If Value = SortField_Terr Then
' same as current sort file, toggle sort direction
SortAscending_Terr = Not SortAscending_Terr
End If
ViewState("SortField_Terr") = Value
End Set
End Property

Property SortField_EmpTerr() As String
Get
Dim o As Object = ViewState("SortField_EmpTerr")
If o Is Nothing Then
Return [String].Empty
End If
Return CStr(o)
End Get
Set(ByVal Value As String)
If Value = SortField_EmpTerr Then
' same as current sort file, toggle sort direction
SortAscending_EmpTerr = Not SortAscending_EmpTerr
End If
ViewState("SortField_EmpTerr") = Value
End Set
End Property

' SortAscending property is tracked in ViewState for both the
' TerritoryGrid and the EmployeeTerritoryGrid

Property SortAscending_Terr() As Boolean
Get
Dim o As Object = ViewState("SortAscending_Terr")

If o Is Nothing Then
Return True
End If
Return CBool(o)
End Get
Set(ByVal Value As Boolean)
ViewState("SortAscending_Terr") = Value
End Set
End Property

Property SortAscending_EmpTerr() As Boolean
Get
Dim o As Object = ViewState("SortAscending_EmpTerr")

If o Is Nothing Then
Return True
End If
Return CBool(o)
End Get
Set(ByVal Value As Boolean)
ViewState("SortAscending_EmpTerr") = Value
End Set
End Property[FONT=courier new]