More in this section

Forums / Developing with Sitefinity / Search Widget in master page

Search Widget in master page

4 posts, 1 answered
  1. Dev
    Dev avatar
    18 posts
    Registered:
    18 Jan 2013
    21 Jan 2013
    Link to this post
    Hi,

    I am trying to add a search bar in the master page. So,  I have these two lines in my master page
    <%@ Register Assembly="Telerik.Sitefinity.Search.Impl" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>
    <sfSearch:SearchBox ID="searchBox1" runat="server"></sfSearch:SearchBox> 

    Normally, when we add the searchbox from the backend, when you click edit, we can specify the index to be used and the target results page. But when you add the search bar in master page, how can we specify these two properties? The search results page is a backend page which url looks like ~/searchresults. 
  2. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    22 Jan 2013 in reply to Dev
    Link to this post

    Hi Prashant,

    I would guess you can include the properties you would normally set in the backend in your markup as well, but you would probably have to set these to the GUIDs of the desired page, search index, etc. I did it by creating a page template based on the master page and dragging the widget onto it to set the properties in the normal way there.

  3. Dev
    Dev avatar
    18 posts
    Registered:
    18 Jan 2013
    22 Jan 2013 in reply to Arno
    Link to this post

    Arno,

    Thanks for your comment. Here is what I have done 

    <%@ Register Assembly="Telerik.Sitefinity.Search.Impl" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>

    sfSearch:SearchBox ID="searchBox1" SearchIndexPipeId="Guid Goes here" ResultsUrl="~/SearchResults" IndexCatalogue="Test" runat="server"></sfSearch:SearchBox> 

    I initially had just resultsurl and Indexcatalogue properties. It started working only after I grabbed the guid from sf_publishing_pipe_settings table for the index I created in the backend. 


  4. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    24 Jan 2013
    Link to this post
    Hi Prashant,

    Glad to hear that you managed to get it working - basically there are several properties which you need to set to the search control:

    SearchIndexPipeId
    ResultsUrl

    After configuring them properly you should be able to take advantage of the search index.

    Regards,
    Victor Velev
    the Telerik team
    Answered
4 posts, 1 answered