When I create a custom page for SharePoint or indeed any custom branding, I like the minimalist approach.  That is a strip out all the OOTB stuff and go back to the minimum I can get away with.  Only this time when I stripped this particular page/masterpage back I ended up with the javascript error “Pub is Undefined”.  Well in fact I didn’t see that error until I used the F12 tools in IE.  The symptoms were that the page just would not switch to Edit mode unless I called the action from the main “Site Actions” menu. Using the “Edit” button on the menu didn’t work.  Had to be a javascript error for sure I thought.  So I just got out the V4 masterpage and began stripping back again until I came to this well known Delegate Control:

<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Id="PublishingConsoleDelegate" />

Which seemed to be the culprit.  No actual Publishing console appears in SharePoint 2010. It’s all in the Ribbon.  But I guess some little leftover from 2007 seems to require this to work fully.  I guess it just forces the loading of the SP.UI.Pub.Ribbon.js which seemed to be the missing file.  So there you go, another solution to the mysterious “Pub is undefined” error when building hghly customized SharePoint pages which use the Publishing Features… you still need the above control for everything to work smoothly.

Cheers

Dave Mc

 

 

7 responses

  1. Dave, thank you so much! You just saved me a lot of time!

  2. Thanks a bunch.
    Works like a charm (if the delegatecontrol is missing that is).

  3. Thanks Dave. This is really helpful. U saved my UAT build 🙂

  4. Dave, thank you for the post.

    I ran into the same issue and was able to resolve it with one masterpage but second masterpage still gives same error, although I have added this control. Is there any other controls/contentplaceholder (if missing) could cause this issue?

    Thank you.

    1. Is the second masterpage in a different site? Can only suggest at the moment that you check for any other javascript errors and check that the javascript file links all match.

      Cheers

      Dave

      1. I guess sometimes you need a second eye or in my case … little bit of sense. It’s spelling mistake that I had on my second master page delegate control that was causing the issue. I know its inexcusable but I am just glad it’s working. Again thanks Dave, your solution rocks!

  5. Thank you Dave,

    2 days I’m looking for a solution. thank you very much

Leave a reply to Celbester Cancel reply

The Blog

Dave Mc muses about history, travel, writing, coaching, astronomy, technology and life, family and the world around us. You may agree with his opinions, you may not, that’s life …