1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Blog paging incorrect after filtering data

Blog paging incorrect after filtering data

2 posts, 0 answered
  1. Jodie
    Jodie avatar
    59 posts
    Registered:
    09 Oct 2012
    12 Mar 2010
    Link to this post
    Hi all,

    I have seen an answer to this question before, but can't seem to find it again.

    I have implementent a custom metafield called 'PostAuthor' for each post in our blog and when the blog list is displayed if you click on the 'Authors Name' it redirects to the blog page with the querystring of the author ( blog.aspx?Author=AuthorName ) an in the page load event in the ContentViewItemList control I am getting the querystring and passing it to a function to filter the data and rebind the repeater:

    01.Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    02.    AddHandler Me.repeater.ItemDataBound, AddressOf Me.repeater_ItemDataBound
    03. 
    04.    Dim Author As String = Request.QueryString("Author")
    05.    If Not String.IsNullOrEmpty(Author) Then
    06.        Me.litBlogTitle.Text = "Posts by " & Author
    07.        SetPostFilter("PostAuthor", Author)
    08.    End If
    09. 
    10.End Sub
    11. 
    12.Private Sub SetPostFilter(ByVal FilterField As String, ByVal FilterValue As String)
    13.    Dim ContentManager As New Telerik.Cms.Engine.ContentManager("Blogs")
    14.    Dim BlogFilter As New List(Of Telerik.Cms.Engine.IMetaSearchInfo)()
    15.    BlogFilter.Add(New MetaSearchInfo(Telerik.Cms.Engine.MetaValueTypes.ShortText, FilterField, FilterValue))
    16.    Dim FilteredBlogs As IList = ContentManager.GetContent(String.Empty, BlogFilter.ToArray())
    17.    repeater.DataSource = FilteredBlogs
    18.    repeater.DataBind()
    19.End Sub

    Now this is all working great however when the filter is applied the pager is still showing the paging for the original set of ressults (unfiltered) instead of the new filtered results. How do I change the pager to reflect the filtered results?

    As always any help is appreciated.

    Cheers

    Jodie
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    12 Mar 2010
    Link to this post
    Hello Jodie,

    1. I suggest that you should use mode tempalates

    • ListPageMaster
    • ListPageDetails

    2. Use a custom control instead of User Control to filter the items. It seems that in the user control CreateContentList() of the base is called before you make the filtering which results in an incorrect paging.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered