none
Add WebPart to MasterPage? RRS feed

  • Question

  • How do you add a Custom Web Part to a Masterpage? I just read and noticed that you cannot add a WebPart zone to a master page but it says you can add a web part. I tried going through SharePoing designer and dragging it to the canvas but it wont let me. Any ideas?
    Victor Palma
    • Moved by Mike Walsh FIN Thursday, August 6, 2009 7:10 AM spd q -> design/Cust; master page q -> Design/Cust (From:SharePoint - Development and Programming)
    Wednesday, August 5, 2009 9:51 PM

Answers

  • I avoided any work around by simply creating a user control. Although I am not able to clearly attach to the debug process. Thank you everyone.

    Victor Palma
    • Marked as answer by Chengyi Wu Monday, August 10, 2009 7:23 AM
    Friday, August 7, 2009 2:28 PM

All replies

  • Hi,

    You should add webpart where necessary on layout pages instead of master page, you can drop web part zones + webpart on layout pages using SPD.



    Ashraf ul Islam
    Sharepoint Consultant
    Wednesday, August 5, 2009 10:02 PM
  • I know that but I want to add it to the actual masterpage. It is part of the branding. Else I was going to build a user control but i cannot debug or attach to the w3wp process in order to debug

    Victor Palma
    Wednesday, August 5, 2009 10:29 PM
  • we can add a webpart to masterpage directly.  I have done it successfully
    first of all, you should check whether your webpart is correct. you can add a default webpart of moss to your masterpage. if success, your customize webpart must have some wrong!

    sencondly,  you can check the event log, you will find some mistake detail.

    if you can, I hope you offer part of your masterpage source code.  then we can help you check it.
    coding
    Thursday, August 6, 2009 2:59 AM
  • Moving to Design/Customization (master page question)
    WSS FAQ sites: http://wssv2faq.mindsharp.com and http://wssv3faq.mindsharp.com
    Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx
    Thursday, August 6, 2009 7:09 AM
  • nothing wrong with the web part. I tried dragging and dropping a web part (any web part out of the box from SharePoint) and SharePoint designer will not place it.

    Victor Palma
    Thursday, August 6, 2009 6:44 PM
  • Did you check out the masterpage?  The file in masterpage library is protected by sharepoint.
    coding
    Friday, August 7, 2009 1:51 AM
  • 1.       You can only add static web part in master page(outside web part zone), you cannot add dynamic one in master page.

    2.       You should not place the web part in any <asp:ContentPlaceHolder />, everything inside this tag will be replaced by content page. Instead, you should drag & drop the OOB web part in side standard HTML tags. For example, I drag & drop a OOB Tasks web part inside a <table />, and it shows up in both SPD and site.

     

    For more help on customizing master pages, please refer to this article: http://msdn.microsoft.com/en-us/library/ms476046.aspx


    Keep It Simple and Stupid.
    Friday, August 7, 2009 2:07 AM
  • I avoided any work around by simply creating a user control. Although I am not able to clearly attach to the debug process. Thank you everyone.

    Victor Palma
    • Marked as answer by Chengyi Wu Monday, August 10, 2009 7:23 AM
    Friday, August 7, 2009 2:28 PM
  • Hi,

    You can do it easily after deploying the webpart and activatining corresponding feature.

    You add a new <asp:ContentPlaceHolder />, (so that no one can replace that one in content page). Within that insert the webpart using designer menu of SPD 2010.

    Wednesday, November 30, 2011 5:35 AM