Building A Ribbon Tab Loading WebPart

I recently had the requirement where I was building a custom contextual group in the 2010 ribbon tab. By default, as an admin, SharePoint appears to choose which ribbon it uses in simple cardinal order. But, it is fairly easy to get around this limitation. In the PreRender event of a WebPart, just slap in this code:


 protected override void OnPreRender(EventArgs e)
            SPRibbon ribbon = SPRibbon.GetCurrent(Page);
            if (ribbon != null)
                ribbon.Minimized = false;
                ribbon.CommandUIVisible = true;
                const string initialTabId = “[Put your tab ID here]”;
                if (!ribbon.IsTabAvailable(initialTabId))
                ribbon.InitialTabId = initialTabId;


easy peasy.


One Comment

  1. thomaspotts says:

    Great information. I’ve just recently started reading your blog but it has had loads of great information.

Leave a Reply

Your email address will not be published. Required fields are marked *