More in this section

Search issue

2 posts, 0 answered
  1. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    02 Dec 2011
    Link to this post
    I am new to sitefinity 4.3. I tried adding some custom code and removed the <sfSearch:SearchBox ID="topSearchBox" runat="server" /> from the default sitefinity search results template. After saving the template i am getting this error.

    Server Error in '/' Application.

    A required control was not found in the template for "~/SfCtrlPresentation/_SFCT_/6ac2df57bca068d836a11c09d72ef6c9ee4c0e42/SearchResults.ascx". The control must be assignable from type "Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox" and must have ID "topSearchBox".

    I tried restarting application pool still i am getting this error. How to resolve this. Please reply ASAP.
    Thanks,
    sathya
  2. Grace Hallwachs
    Grace Hallwachs avatar
    144 posts
    Registered:
    03 Nov 2014
    02 Dec 2011
    Link to this post
    Hi Sathiyaseelan,

    When you try to remove the searchbox from the search template the code behind still references the searchbox and since you removed it, the template errors out.

    To fix this issue, you can put the searchbox inside a div tag and then use style="display:none;" to hide the searchbox. This way the searchbox is not visible but the code behind can still reference that code. I have included a sample of the search template code that includes the style="display:none;" property. To access the search template widget, you can go to Design -> Widget templates -> Search and Indexes:


    <%@ 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" %>
      
    <div id="Some" style="display:none;">
    <sfSearch:SearchBox ID="topSearchBox" runat="server" />
    </d>
      
    <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 let us know if you have any questions or concerns.

    Greetings,
    Grace Hallwachs
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered