Out of the Box Search Box Empty Text

Posted by Community Admin on 03-Aug-2018 20:50

Out of the Box Search Box Empty Text

All Replies

Posted by Community Admin on 07-Mar-2017 00:00

I would like to add something like "Enter Search Term Here" for the search box text when the page loads, much like the EmptyMessage feature of radtextbox.  Is there a way to easily do this with the out of the box search control? 

Posted by Community Admin on 08-Mar-2017 00:00

Hi James,

For Search Box MVC widget, sitefinity has BackgroundHint setting (SearchBoxBackgroundHint image).  For old widget, SF doesnt have this setting, you can do that by modifying template of search box. You can do that on this way:

1) Save this code as SearchBox.ascx

<%@ Control Language="C#" %>
<%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
<sitefinity:ResourceLinks id="resourcesLinks" runat="server" UseEmbeddedThemes="True" UseBackendTheme="True">
    <sitefinity:ResourceFile JavaScriptLibrary="JQuery" />
    <sitefinity:ResourceFile JavaScriptLibrary="KendoAll" />
<%--    <sitefinity:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_common_min.css" Static="true" />
    <sitefinity:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_default_min.css" Static="true" />
    <sitefinity:ResourceFile Name="Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_mobile_all_min.css" Static="true" />--%>
</sitefinity:ResourceLinks>
 
<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>

2) Place it inside of your project

3) Edit this template and put any placeholder

4) Go to widget settings of "Search Box" widget and change LayoutTemplatePath to the new path

Posted by Community Admin on 08-Mar-2017 00:00

Thank You!  The MVC was the key and it looks great.  

This thread is closed