Search issue
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.
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"
/>