Try Now
More in this section

Forums / Module Builder / Paging issues with frontend filtering of Dynamic Content Type

Paging issues with frontend filtering of Dynamic Content Type

2 posts, 0 answered
  1. Gavin
    Gavin avatar
    6 posts
    08 Oct 2012
    16 Oct 2014
    Link to this post

    I have created a module using the Module Builder and have added frontend filtering to the list of items exactly as this sitefinity blog post describes. The frontend filtering is working just fine however the built-in paging does not function correctly when any sort of filtering gets applied.

    By built-in paging I mean going to backend, then going to the page where the widget has been placed, then clicking on widget edit, going to "list settings" then selecting the "use paging" radio button. The paging will work as expected until you decide to do some filtering. For example, using the "Offices" module as described in the linked post above, if you were to search for a particular City that wasn't on the first page, it won't be returned.

    I believe the problem is the way the DataSource is obtained in the "SearchButton_Click" event handler (see blog post). By that I mean I think when paging is used, the retrieved DataSource when filtering only contains the items on the current page. To show how the data source is obtained, I've included the "SearchButton_Click" method from the blog post example below:

    void SearchButton_Click(object sender, EventArgs e)
                var dataSource = ((IEnumerable<DynamicContent>)this.DynamicContentListView.DataSource);
                if (!this.CityTextBox.Text.IsNullOrEmpty())
                    dataSource = dataSource.Where(itm => itm.GetValue(cityFieldName).ToString().Contains(CityTextBox.Text));
                if (!this.CountryTextBox.Text.IsNullOrEmpty())
                    dataSource = dataSource.Where(itm => itm.GetValue(countryFieldName).ToString().Contains(CountryTextBox.Text));
                if (!this.ZipCodeTextBox.Text.IsNullOrEmpty())
                       dataSource = dataSource.Where(itm => itm.GetValue(zipFieldName).ToString().Contains(ZipCodeTextBox.Text));
                this.DynamicContentListView.DataSource = dataSource.ToList();

     Does anyone know how to get the paging to work with custom frontend filtering? (or vice-versa)

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    17 Oct 2016
    21 Oct 2014
    Link to this post
    Hello Gavin,

    I have answer you in the support ticket.

    Once you have the solution, you can share it with the community.

    Svetoslav Manchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered