Monday, July 20, 2009

Hiding the Search Box When Printing

* Open the master page in SharePoint Designer
* Add the following style either to a CSS file included in the master page or as a style within the master page itself:

@media print{
.HideForPrinting
{
display:none;
}
}

* Locate the delegate control used to display the search box and add the code shown in italics:

<asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”>
<span class=”HideForPrinting”>
<SharePoint:DelegateControl runat=”server” ControlId=”SmallSearchInputBox”/>
</span>
</asp:ContentPlaceHolder>

This defines a span that uses the style HideForPriting, the content of which will be hidden when the page is printed.