Thursday, June 16, 2011

Add Web Part inside Master Page in Sharepoint

How you can make a custom web part as part of your master page?

Follow the steps given below to add a web part inside a master page.

1. Deploy the web part in your web application as you do normally.
2. Check whether the web part is showing up in the web part gallery.
3. Create a web part page by navigating to the site settings, create web part page.
4. Add your custom web part on the web part page.
5. Start SharePoint designer and open the newly created web part page.
6. You will now find two entries corresponding to the web part you added on the page
In the page declaration you will find a entry which looks something like this:


"<%@ Register TagPrefix="WpNs0" Namespace="MyNamespace.MyClass" Assembly=" MyNamespace.MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"%>"


Click on the web part section in the page and you will see an entry like this:


"<WpNs0:WebPartName runat="server" ID="g_34cdbb90_38c6_4561_9182_8fbc0d2423a6" ExportMode="All" Title="WebPartTitle" __MarkupType …………….."


7. Copy these entries in separate notepad, and close the page opened in the SharePoint designer.
8. Now open the master page in SharePoint designer and add the first entry in the declaration
section and second entry at the place where you want to add the web part to.
9. Save the page, check in and publish it and that’s it. Your job is done.
10. Now you can save the above two tags for further use and you can remove web part page from your site.

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...