Try our conversational search powered by Generative AI!

Search result change sort order

Vote:
 
Hello, I have a simple but working search function but want change the result sort order by selecting a new sorting from a drop down. The problem is that the result list does not seems to update every time I change drop down selection. Why? Is it some kind of cache problem? from search.aspx:

Sort:
  • "><%# databinder.eval(container.dataitem, "pagename")%> (<%# databinder.eval(container.dataitem, "changed", "{0:d}")%>)

    <%# getpreviewtext(container.dataitem as episerver.core.pagedata) %>

  • and from the search.aspx.cs protected void SortDropDownList_Changed(object sender, EventArgs e) { System.Web.UI.WebControls.DropDownList sortDropDown = (System.Web.UI.WebControls.DropDownList)sender; // public enum FilterSortOrder // --------------------------- // Alphabetical Sorted alphabetical on name // ChangedDescending Most recently changed page will be first in list // CreatedAscending Oldest created page will be first in list // CreatedDescending Most recently created page will be first in list // Index Sorted on page index // None // PublishedAscending Oldest published page will be first in list // PublishedDescending Most recently published page will be first in list // Rank Sort on ranking, only supported by special controls switch (sortDropDown.SelectedValue) { case "Alphabetical": SearchResult.SortOrder = EPiServer.Filters.FilterSortOrder.Alphabetical; break; case "AlphabeticalDescending": SearchResult.SortOrder = EPiServer.Filters.FilterSortOrder.Alphabetical; SearchResult.SortDirection = EPiServer.Filters.FilterSortDirection.Descending; break; case "CreatedDescending": SearchResult.SortOrder = EPiServer.Filters.FilterSortOrder.CreatedDescending; break; case "CreatedAscending": SearchResult.SortOrder = EPiServer.Filters.FilterSortOrder.CreatedAscending; break; } } thanx
    #13329
    Jan 22, 2008 14:57
    Vote:
     
    Om Du använder en PageSearch för att presentera resultatet, så finns det en egenskap där för sortering SearchResults.SortBy = drpSort.SelectedValue.ToString(); I listboxen har jag egenskaper på sidan Senast startat Senast avslutat
    #15603
    Jan 24, 2008 14:29
    Vote:
     
    Thank you for the reply Helena, however, my problem seems to be that the EPiServer:PageList is not updated correctly. PageList too has a SortBy property (though I am using SortOrder and SortDirection), but it only change the sort sometimes. Perhaps due to cache?
    #15604
    Jan 28, 2008 14:02
    * You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.