Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, March 19, 2012

How to Add a Custom WebPart within a SharePoint Master Page.

 

How to Add a Custom WebPart within a SharePoint Master Page.
  • First write your logic and deploy a WebPart to a SharePoint site.
  • Add a New WebPart and add the custom WebPart you have developed.
  • Now open the page within a SharePoint Designer.
  • Now Open a Notepad.
  • Now you have to copy the two things.
  • Copy the Register tag within the Page. This will be in the format as shown below.
  • <%@ Register TagPrefix="WpNs0" Namespace="GroupUsersGrid.GroupUsersGrid" Assembly="GroupUsersGrid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b5c7b45489124c1b"%>
  • Now copy the WebPart Code Generated by SharePoint to your Notepad.
  • This will be in the format as shown below.
  • <WpNs0:GroupUsersGrid runat="server" ID="g_a0e35373_6571_4956_83b1_3cee01e35a1a" Description="My Visual WebPart" Title="GroupUsersGrid" __MarkupType="vsattributemarkup" __WebPartId="{A0E35373-6571-4956-83B1-3CEE01E35A1A}" WebPart="true" __designer:IsClosed="false" partorder="2"></WpNs0:GroupUsersGrid>
  • Now close the WebPart Page.
  • Now Open your Master Page.
  • Now First copy the Register Tag in the Top of the Master Page.
  • Now go to the specified TD where you want to show the WebPart.
  • Now the WebPart Code you have copied before, please select it and copy to the Appropriate TD.
  • Now save the Master Page and run the site.
  • Now you will see the WebPart on Your SharePoint Site Globally.

No comments:

Post a Comment