Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

Hiding the Search Box When Printing

leave a comment »

Ever noticed that the search box is shown on a SharePoint page when printed while other parts of the page are hidden?

HidePrint1

The Search box can be hidden, along with other parts of a form you don’t want printed by using styles. This can be done using Microsoft Office SharePoint Designer:

  • 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.

Advertisements

Written by Nick Grattan

October 1, 2008 at 8:07 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: