Displaying a webpart (your own custom made or any of the
OOTB ones) in the master page of your site might not be directly supported by
the GUI, but it requires minimal effort and no coding.
The easiest way that I found is to add
the web part to a normal page (not within a zone), open this page in Sharepoint
Designer and copy the generated code. This code can then be inserted into the
masterpage where you want it displayed, and then finally add the tag prefix in
the header of the masterpage to reference the webpart assembly.
Here’s an example:
The following code is the generated
markup for my SP_Tests_WP WebPart.
<WpNs0:SP_Tests_WP runat="server" ID="g_e932ec34_a94e_4ae4_88e7_bc8df28db334"
Description="Mon
composant Visual WebPart" Title="SP_Tests_WP" ImportErrorMessage="Impossible d’importer ce composant WebPart."
__MarkupType="vsattributemarkup"
__WebPartId="{E932EC34-A94E-4AE4-88E7-BC8DF28DB334}"
WebPart="true"
__designer:IsClosed="false"
partorder="2"></WpNs0:SP_Tests_WP>
Take note of the « WpNso »
prefix, this is the one that references to the webpart assembly. You will find
the reference at the top of the page, looking a little something like this:
<%@ Register
Tagprefix=" WpNs0" Namespace="SharePointProject_Test.
SP_Tests_WP " Assembly=" SharePointProject_Test, Version=14.0.0.0,
Culture=neutral, PublicKeyToken= 7a77e7fcb2276b4c" %>
Just copy the
same tag prefix to the masterpage and you’re done!