+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Combining 3rd party Search with Sitefinity Search

Combining 3rd party Search with Sitefinity Search

3 posts, 0 answered
  1. Jesse
    Jesse avatar
    6 posts
    Registered:
    10 Aug 2011
    13 Sep 2012
    Link to this post
    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?

     
  2. Jesse
    Jesse avatar
    6 posts
    Registered:
    10 Aug 2011
    13 Sep 2012
    Link to this post
    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?
  3. Jesse
    Jesse avatar
    6 posts
    Registered:
    10 Aug 2011
    18 Sep 2012
    Link to this post
    Could really use a reliable method of getting the search term for use in the code behind.
3 posts, 0 answered