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

Forums / General Discussions / Search Box Template

Search Box Template

12 posts, 1 answered
  1. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    14 Jan 2011
    Link to this post
    Hi Team,

    I just upgraded my sitefinity 4 project to RC 2 this week and i was able to add the search box to the master page using the following code:

    <%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" Assembly="Telerik.Sitefinity" %>
     
     
    <sitefinity:SearchBox ID="searchBox" runat="server" IndexCatalogue="MyIndex" ResultsUrl="~/Search"></sitefinity:SearchBox>

    However, i checked the widgets templates and i am not able to modify the template for the search box. I need to remove or style the fieldset and change the layout.

    Is it possible in this release or should i just try a workaround and override the css classes for the control with custom css?

    Thanks,

    G
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 Jan 2011
    Link to this post
    Hi George ,

    You can map the template by using LayoutTemplatePath property. Below is the declaration of the template

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
     
    <fieldset id="main" class="sfsearchBox" runat="server">
        <asp:TextBox ID="searchTextBox" runat="server" CssClass="sfsearchTxt" />
        <asp:Button  id="searchButton" runat="server" Text="<%$Resources:SearchResources, Search %>" OnClientClick="return false;" CssClass="sfsearchSubmit" />
    </fieldset>



    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    14 Jan 2011
    Link to this post
    Hi Ivan,

    Thank you for your response, I have mapped the external template as you suggested and changed the layout. However, the other issue is that the control is not working

    I have set the properties as follows

    <sitefinity:SearchBox ID="searchBox" runat="server" IndexCatalogue="MyIndex" ResultsUrl="~/Search" LayoutTemplatePath="~/Custom/ControlTemplates/SearchBox.ascx"></sitefinity:SearchBox>

    I have created the myIndex catalog in the back-end and also the Search page holding a SearchResults control and the search is not being submitted through the control. I have removed the OnClientClick event and also tried to remove the LayoutTemplatePath but still not working.

    I have tried to add the control to a test page from the toolbox and it worked but the one i added to the master page didn't and there is not Javascript error.

    Any suggestions?

    Appreciate it in advance.
  4. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    17 Jan 2011
    Link to this post
    Hi Ivan,

    Do you have any input on the above.

    Appreciate it.

    G
  5. Jordan
    Jordan avatar
    172 posts
    Registered:
    20 Oct 2015
    19 Jan 2011
    Link to this post
    Hello George ,


    Can you send us a quick mock-up of the the search widget that you want to create? I think it would be easier for us to help you and to propose the best solution.


    Best wishes,
    Jordan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    24 Jan 2011
    Link to this post
    Hi Jordan,

    I have attached an image of the layout that i am trying to achieve for the search box. I managed to add the search box to the master page as a control (i have added the code in this thread). 

    The only problem is that once i embed the search box in the master page and not through sitefinity the button do not trigger a postback.

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
      
     <div class="searchbox">
        <asp:TextBox ID="searchTextBox" runat="server" CssClass="searchText" ClientIDMode="Predictable" />
        <asp:Button  ID="searchButton" runat="server" Text="Search"  CssClass="searchSubmit" OnClientClick="return false;" />
    </div>
     
    <script type="text/javascript">
     
        $(function () {
            var searchBox = $("[id$='_searchTextBox']");
     
            addWaterMark(searchBox, 'search');
        });
     
    </script>


    Thanks,

    G
  7. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    24 Jan 2011
    Link to this post
    After investigating the generated code, I found that the index catalog in the javascript code is not being set ... How will i be able to set the index catalog? and what is SearchIndexPipeId property?

                    Sys.Application.add_load(loadHandler);
                    })();Sys.Application.add_init(function() {
    $create(Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox, {"indexCatalogue":"","resultsUrl":"/Search","searchButton":$get("searchBox_ctl00_ctl00_searchButton"),"searchTextBox":$get("searchBox_ctl00_ctl00_searchTextBox"),"wordsMode":0}, null, null, $get("searchBox"));


    Thanks,

    G
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    26 Jan 2011
    Link to this post
    Hello George ,

    You can use the built-in SearchBox control.  You have to set SearchIndexPipeId property. It gets or sets the ID of the search index pipe from which the search catalogue is resolved. The easiest way to get the pipe Id is to make a query to [sf_publishing_pipe_settings] table of the database.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  9. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    27 Jan 2011
    Link to this post
    Hi Ivan,

    I tried your solution and it finally worked. 

    Appreciate it 

    Best,

    G
  10. Anu
    Anu avatar
    72 posts
    Registered:
    17 Jun 2010
    17 Aug 2011
    Link to this post
    Hi George ,

    Can u Please share ur Search Code Step by Step ... i have Created my Site in Sitefinity 4.0 ... i want to implement Site Search ...

    Please wil be highly Appreciated ...

    Thanks & Regards
    Anu.
  11. Pravat
    Pravat avatar
    59 posts
    Registered:
    22 Jun 2010
    31 Aug 2011
    Link to this post
    Hi Ivan,

    Can u Please share ur Search Code Step by Step ... i have Created my Site in Sitefinity 4.0 ... i want to implement Site Search ...



    Thanks & Regards,
    Pravat Sharma
  12. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    03 Sep 2011
    Link to this post
    hey guys,

    Sorry for the late reply. Check out this blog post, i explained it there

    http://gsaadeh.com/blog/11-05-31/Adding_Searchbox_directly_to_your_Template_in_SF_4.aspx

    Cheers
12 posts, 1 answered