Try Now
More in this section

Forums / Developing with Sitefinity / Filter Search Results by Library

Filter Search Results by Library

2 posts, 0 answered
  1. BoaMike
    BoaMike avatar
    51 posts
    25 Sep 2009
    22 Nov 2013
    Link to this post
    I have a series of pages that each contain: a Download List widget set to show documents from a given Document  Library (different on each page), a Search Box widget and a  Search Results widget.  I want to filter the search results so that it only returns documents from the Download List on the current page.  I'm able to hook into the search results and get the library that the returned documents reside in, but I don't know how to get the Library associated to the Download List on the current page.  Does anyone know how to get that, or is there some other approach I can use to achieve the desired result?

  2. Bonny
    Bonny avatar
    58 posts
    11 Oct 2016
    25 Nov 2013
    Link to this post

    As I understand, you want to have some kind of relation between two controls on the same page. Getting the parent library id directly from the download list is not recommended, because it will expose various problems/glitches as a long term solution.
    You can simply extend the DownloadListView to store somewhere its library id. Then get this is from search results widget.
    The Library id itself can be accessed in DownloadListView's inheritor with code like this:((Telerik.Sitefinity.Web.UI.ContentUI.ContentViewMasterDefinition)(this.CurrentView)).ItemsParentId
    Another option is to extend search results view to expose additional property "LibraryId" or "ParentUrl" for example that will be visible in the control designer. There you can store the current library id and use it when the results are bound. In this case this article may be useful

    Please contact me again if you have some comments/suggestions about this approach.

    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 Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered