Filter Search Results by Library
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?
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