Combining 3rd party Search with Sitefinity Search

Posted by Community Admin on 03-Aug-2018 16:52

Combining 3rd party Search with Sitefinity Search

All Replies

Posted by Community Admin on 13-Sep-2012 00:00

I'm attempting to combine Sitefinity's search results with a set of search result data from a 3rd party. The problem I'm running into is accessing the search terms from the search box. I figured that since the search box doesn't clear the user's search terms after they submit a search, I could just grab the search string from the search box when the search results page loads. However, I have no idea how to retrieve the string.

I have a master page with a placeholder on it that I've dropped the search box control into. On the Search Results page, I have a custom control that will retrieve the search string on page load, and then display the search results. I tried:

((TextBox)Page.Master.FindControl("searchTextBox"))

from the code behind of my custom control, but that finds nothing. Looking at the source shows the ID for the search box as "ctl00$Search$TCE5DF3E6002$ctl00$ctl00$searchTextBox" so there's another layer aside from the master page I need to go through, I just have no idea what it is. Anyone have any ideas or perhaps a better method of getting the search terms?

 

Posted by Community Admin on 13-Sep-2012 00:00

After doing more digging, it seems like Sitefinity generates the ID of the search box on the fly. So in my example:  ctl00$Search$TCE5DF3E6002$ctl00$ctl00$searchTextBox
the "Search" part of the string is the ID for my placeholder 
the "TCE5DF3E6002" is the ID of the control generated by Sitefinity
and the "searchTextBox" is the ID of the textbox control the user is actually inputting their search term into.

So, the control ID "TCE5DF3E6002" seems to be what I need to be able to programmatically retrieve. The question is, how?

Posted by Community Admin on 18-Sep-2012 00:00

Could really use a reliable method of getting the search term for use in the code behind.

This thread is closed