Filter Search Results by Library

Posted by Community Admin on 04-Aug-2018 16:47

Filter Search Results by Library

All Replies

Posted by Community Admin on 22-Nov-2013 00:00

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?

Posted by Community Admin on 25-Nov-2013 00:00

Hi,

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.

Regards,
Bonny
Telerik

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

This thread is closed