More in this section

Forums / General Discussions / Out of the Box Search Box Empty Text

Out of the Box Search Box Empty Text

3 posts, 0 answered
  1. James
    James avatar
    0 posts
    Registered:
    27 Oct 2015
    07 Mar
    Link to this post
    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? 
  2. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    Registered:
    01 Jul 2014
    08 Mar in reply to James
    Link to this post

    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

  3. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    08 Mar in reply to Victor Leontyev
    Link to this post
    Thank You!  The MVC was the key and it looks great.  
3 posts, 0 answered