How to hide search control on default.master


Summary:

This post describes how to hide the search control on default.master. The steps described below are applicable for other master pages, as well.

Resolution:

  1. Open SharePoint Designer 2007. Go to File | Open Site and connect to SharePoint site.
  2. Expand out _catalogs -> masterpage -> open default.master. Check out file, if necessary.
  3. In Code View, search for “PlaceHolderSearchArea”. After id=”PlaceHolderSearchArea”, add the following property: Visible=”false”. In all, the code should look something like:
    <asp:ContentPlaceHolder id=”PlaceHolderSearchArea” Visible=”false” runat=”server”>
            <SharePoint:DelegateControl runat=”server” ControlId=”SmallSearchInputBox”/>
    </asp:ContentPlaceHolder>
  4. Save master page, check in (if necessary), and publish major version.

NOTE: To reverse the changes, simply set Visible=”true” on the placeholder.

I decided to write this post as we’ve seen several support cases with questions on how to hide / manipulate the search control on master pages. This post just covers hiding the search box. There are multiple ways to hide the search control, to be sure, including using CSS (ex: “display:none;”).


Comments (5)

  1. Jennifer says:

    Thank you – worked like a charm.

  2. Paula says:

    Thank you!!  It worked perfectly

  3. James says:

    Good Knowledge…

    You explained very well……

  4. Ben McInerney says:

    I think the best-practices way is not to change the Content Placeholder, but rather move the entire block to the "hidden panel" at the end of the master page.

    So that it would look like this:

    <!— — —  Hidden Placeholders — — —>

    <asp:Panel visible="false" runat="server">

    <!– Place unused Content Placeholders here –>

    <asp:ContentPlaceHolder id="PlaceHolderSearchArea" Visible="true" runat="server">

           <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>

    </asp:ContentPlaceHolder>

    </asp:Panel>

    <!— — —  End of Hidden Placeholders — — —>

    Cheers,

    Ben