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.MakeTabAvailable(initialTabId);
- }
- ribbon.InitialTabId = initialTabId;
- }
- base.OnPreRender(e);
- }
easy peasy.
Articles & Research
SharePoint Security
SharePoint Development
SharePoint Architecture
Claims Authentication
Forefront For SharePoint
AIS / Dynamics GP
Team Foundation Server
Pex And Moles
ISA/TMG/IAG/UAG
DPM
Cardspace
Research Methodology
Rural ICT Development
Numerical Analysis
Multi-Level Research
Knowledge Management
Personal/Off-Topic
Great information. I’ve just recently started reading your blog but it has had loads of great information.