I am customizing the code for WebLink 9 to change the default sort order on specific folders. In the "Browse.aspx.vb" code behind, I updated the SetFolderColumns method to add an "Else" branch to the "If Not IsNothing(PrefsCookie)" conditional (see code sample below). The issue I am running into is the folder contents are still being sorted by Name in ascending order. If the folder contains a pagination bar at the bottom of the screen, changing the page of records will also update the column sorting to be sorted in the correct order. Is there a reason this isn't working when the folder contents are first loaded and it is requiring the record page to be changed?
' Get sort preference cookies
Dim PrefsCookie As HttpCookie = Request.Cookies(PrefsCookieName)
If Not IsNothing(PrefsCookie) Then
Try
' This is in a try block in case a non-integer value somehow made
' its way into the cookie
If Not IsNothing(PrefsCookie.Values.Item("SortField")) Then
TheDocumentBrowser.DefaultSortField = PrefsCookie.Values.Item("SortField")
ElseIf Not IsNothing(PrefsCookie.Values.Item("SortColumn")) Then
TheDocumentBrowser.DefaultSortColumn = PrefsCookie.Values.Item("SortColumn")
End If
If Not IsNothing(PrefsCookie.Values.Item("SortDirection")) Then
TheDocumentBrowser.DefaultSortDirection = PrefsCookie.Values.Item("SortDirection")
End If
Catch
End Try
Else
TheDocumentBrowser.DefaultSortColumn = Column_Type.COLUMN_TYPE_NAME
TheDocumentBrowser.DefaultSortDirection = Sort_Direction.SORT_DIRECTION_DESC
End If