I have a requirement to put data retrieval components in the master page, because I would need this data to appear on each page of the site.

Like Upcoming Events, News Feed, so on. What's the best approach to do it? Should I do custom web part farm solution in VS and put it in the master page? Should I use JavaScript instead? What's the best way to put these components in the master page?

1 Answer 1


Standard SharePoint web parts on one page I would add the webparts by code using a feature eventreceiver. Create a SharePoint solution in Visual Studio, add a feature and on the "onActivated" event of the feature you add the web parts to the page by code. If needed a user/site admin can still remove the webparts

Standard SharePoint web parts on all pages Create a SharePoint solution with a master page. You can put web parts on your master page by adding the XML configuration xml on the master page. It's a huge topic, google it for some tutorials. (you can also do this by using SharePoint Designer)

Custom functionality on all the pages Create a SharePoint solution in Visual Studio. Create a master page. Create your custom functionality in a user control. Add this usercontrol to the master pages. I would recommend putting the master page and the user controls in the same solution. If the user controls referenced in the master page are not available you get a nasty error. Site admins and users cannot remove user controls from their (master) pages.

I've done this for custom footers and

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.