Home

SharePoint IT Pro Blog

MSDN Magazine Feed

Thursday, April 30, 2009

Hiding the Web Controls When Printing - example Search Box

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.

No comments: