You are viewing limited content. For full access, please sign in.

Question

Question

WebLink - Programmatically set sort direction on TheDocumentBrowser

asked on December 20, 2018

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

 

0 0

Replies

replied on January 9, 2019

I did rebuild the project using Visual Studio 2017 and I've attached the debugger to the IIS process to verify all of my code is functioning correctly.  DefaultSortColumn and DefaultSortDirection are both set correctly on TheDocumentBrowser.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.