3

I want to leverage the information in the current Search Results on other custom controls and web parts on the page. In this instance I am talking about either the Content Search Web Part or Catalog Item Reuse Web Part.

For example, if I have a CSWP displaying 1 or more results on a page what code is needed in a separate custom web part to also interrogate those results and perform actions based on them?

My current scenario is that I have integrated a Service catalog into my website and have a page displaying each Service (using CSWP). On each Service page we also have a side bar where we need to display other Services that are closest in proximity to the main Service being displayed on the page (of the same Service Type). I would like to be able to inspect the search result from the CSWP web part, find the Service Type and Geographical location and then do a separate Search API call to pull out other local Services.

I'm aware that Search Web Parts do "share" the results to avoid having to make multiple search requests, I just want to achieve the same thing from my custom code (C#). I've been banging my head against a wall debugging the search web parts but can't see how to get at the search results in code! Can anyone help?

  • I dunno of this is possible, but could you achieve it by ways of webparts connections? I didn't know these webparts shared it out of thr box but they probably use some MS only magic :O – Cameron Verhelst Mar 8 '14 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.