Try Now
More in this section

Forums / General Discussions / How to access the Search Results template?

How to access the Search Results template?

3 posts, 1 answered
  1. Ann
    Ann avatar
    16 posts
    25 Aug 2010
    19 Jan 2011
    Link to this post
    First of all, a big thank you goes to Telerik for giving us easy access to widget templates.  This has been a huge help to me and my team!

    We are running Sitefinity 4.0 and are wanting to change the layout for the search results.  I don't see any template of this kind in Design -> Widget Templates, and I've also tried looking in App_Data\Sitefinity\WebsiteTemplates\DefaultTemplate\ControlTemplates but couldn't find anything there as well.  Where can I find an example of a template for the Search Results widget?  Or better yet, where can I find the exact template that is used by Sitefinity as a default when displaying Search Results?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    16 Jun 2017
    19 Jan 2011
    Link to this post
    Hello Ann,

    Here is the template of the public SearchResults control

    <%@ 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" />

    You can use LayoutTemplatePath property of the widget to map the template.

    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. Ann
    Ann avatar
    16 posts
    25 Aug 2010
    19 Jan 2011
    Link to this post
    Thanks for your prompt reply, Ivan.  This was exactly what I was working for.  I just pasted the code into the UI to create a new template for search results (list) and then applied this template to my search results widget. 

    Thanks again,
3 posts, 1 answered