1-888-365-2779
+1-888-365-2779
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
    Registered:
    26 Aug 2008
    11 Apr 2011
    Link to this post
    Hi,

    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.

    Thanks,
    sathya
  2. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    11 Apr 2011
    Link to this post
    Hi,

    I didn't get any reply for this...can u pl have a look..??
  3. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    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 :

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

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

    SearchResults
    <%@ 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">
        <HeaderTemplate>
            <dl class="sfsearchResultsWrp sfsearchReultTitleSnippetUrl">
        </HeaderTemplate>
        <ItemTemplate>
            <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>
        </ItemTemplate>
        <FooterTemplate>
            </dl>
        </FooterTemplate>
    </asp:Repeater>
    <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.

    Regards,
    Boyan Barnev
    the Telerik team

3 posts, 0 answered