How to customize search box and results

Posted by Community Admin on 04-Aug-2018 07:09

How to customize search box and results

All Replies

Posted by Community Admin on 11-Apr-2011 00:00


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.


Posted by Community Admin on 11-Apr-2011 00:00


I didn't get any reply for this...can u pl have a look..??

Posted by Community Admin on 11-Apr-2011 00:00

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

This thread is closed