Try Now
More in this section

Forums / Bugs & Issues / How to customize search box and results

How to customize search box and results

3 posts, 0 answered
  1. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    26 Aug 2008
    11 Apr 2011
    Link to this post

    I am using sitefinity 4 for creating a site. I am using default search control but I can not find physically the files to change the control.

    Please help.

  2. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    26 Aug 2008
    11 Apr 2011
    Link to this post

    I didn't get any reply for this...can u pl have a look..??
  3. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    16 Aug 2017
    11 Apr 2011
    Link to this post
    Hello sathiyaseelan,

    These templates are embedded resources, that's why you cannot find the physical files. If you want to customize them you have to map the templates by going to ~/Administration/Settings/Advanced >> Controls >> ViewMap and click on the Create New button. In the form that opens fill in the fields as follows (all without the quotes):

    HostType: "Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox"
    LayoutTemplatePath: "relative path to your SearchBox.ascx"

    Same goes for SearchResults.ascx, you just have to specify :

    LayoutTemplatePath: "relative path to your SearchResults.ascx"

    Please find below the sample templates, which you can use:
    <%@ 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" />

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>
    <sfSearch:SearchBox ID="topSearchBox" runat="server" />
    <sitefinity:SitefinityLabel id="resultsStats" runat="server" WrapperTagName="p" CssClass="sfsearchResultStatistics" Text="<%$Resources:SearchResources, SearchResultsStatusMessage %>" />
    <asp:Repeater ID="resultsList" runat="server">
            <dl class="sfsearchResultsWrp sfsearchReultTitleSnippetUrl">
            <dt class="sfsearchResultTitle"><a runat="server" href='<%# Eval("Link")%>'><%# Eval("Title") %></a></dt
            <dd class="sfsearchResultSnippet"><%# Eval("Summary")%></dd>
            <dd class="sfsearchResultUrl"><a runat="server"  href='<%# Eval("Link")%>'><%# Eval("Link")%></a></dd>
            <dd class="sfsearchResultHighLighter"><%# Eval("HighLighterResult")%></dd>
    <sitefinity:Pager ID="pager" runat="server" />
    <sfSearch:SearchBox ID="bottomSearchBox" runat="server" />

    Please note that the forums are a community resource, if you wish you can take a look at our Support Options and the guaranteed support response time.

    Boyan Barnev
    the Telerik team

3 posts, 0 answered