I'm working very deeply in SharePoint 2013 branding and I finally figured out what the <!--SID:02 {Ribbon} --> snippet actually brings in -- the code from ~/controltemplates/15/Ribbon.ascx but I'm having difficulty figuring out how to have SharePoint not render that file, but a custom file I created.

I've found several resources that allow you to package a solution that contains some XML that tells SharePoint to render different parts of the ribbon instead of the default ones (such as PromotedActions), but I can't find a resource that would give me the code that would let me have SharePoint render my custom CustomRibbon.ascx opposed to the default one.

Does anyone have any idea how to accomplish this?

Edit: I don't want to mess with the ribbon itself (the Browse and Page parts) but rather add another bar on top of that area, between the blue SharePoint bar and the bar that contains the actual ribbon.


You seriously do not want to start messing with the Ribbon in this way. That critter is like a great white and once you tangle with it, you will bleed for years from places you didn't know existed. Trust me on this: I have the scars to prove it. If you need to add or remove things from the ribbon, follow the XML Feature examples on the web or use the object model as both of those are supported and are less likely to cause help desk related blood loss.

If you need something really out of the ordinary then you might look at creating a custom master page that does not include the Ribbon and only use it for the pages you need the custom behavior for. This can be done either through code or more simply by placing the lists that need this special behavior in their own site and changing the master page for just that site to use your streamlined master on just that page.

  • The thing is, I'm not really looking to mess with the ribbon. I want to really move the PromotedActionsDelegate to the furthest right it can be, and possibly add another <div> between the blue part and the grey part. That's all I'm looking to accomplish, but don't want to mess with the master file. – EHorodyski Apr 4 '13 at 19:55
  • If you realy brand tour site you should worK with master pages. We brand all our customers' sites to make it public facing and there is no way do not to use master pages when brand a site. – Andrew Adamich Apr 4 '13 at 20:04
  • Andrew, when you work with master pages, the only code you get regarding the ribbon is <!--SID:02 {Ribbon} -->. There is nothing else in the master page that dicates how the Ribbon is rendered, just where. – EHorodyski Apr 4 '13 at 20:18
  • Based on your updates it might be as simple as adding a DIV and your custom container above the DIV containing the Ribbon. Again, you can get bit this way as I've seen numerous cases where trying to move the ribbon to anywhere else causes endless scrolling/scaling problems. FWIW, I just ran across this product that might offer an alternative: add-in-express.com/creating-addins-blog/2011/12/15/… – Dave Wise Apr 4 '13 at 20:35
  • We really wanted it to go inbetween so we'd have a larger persistent header. I've gone ahead and figured out exactly what I need to do in Ribbon.ascx, but I just can't figure out how to use a custom file instead of altering the master one. I understand I might be limited to just putting it inside the container for the ribbon and doing it above the ribbon, but then it looks kind of awkward with the site logo underneath. Who knows... – EHorodyski Apr 4 '13 at 20:48

Leaving aside if it is a good idea or not, I've had some success replacing built-in WebControls by using a SharePoint DelegateControl stapling it to the AdditionalPageHead placeholder as described here: https://littletalk.wordpress.com/2010/11/18/create-an-additionalpagehead-control-packed-into-a-feature-in-visual-studio-2010/

Your custom WebControl then needs to contain code to loop through the ASP.NET controls collection recursively and find the Ribbon ASCX control.

Basically something like the pseudo-code below (though it is much simplified for brevity):

First, get the ASP.NET controls of the current page:


Then find the Ribbon.ascx (either loop recursively or use another smart way to find it deep down the controls collection):

if (childControl.ToString().ToLower() == "ribbon.ascx")

Note: haven't tried this code snippet myself because I don't have my development VM with me, but it should serve you as an example to get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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