I've a custom contextual ribbon tab element and I'm initializing it throw the following code on a webcontrol hosted on the masterpage:
protected override void OnPreRender(EventArgs e)
{
LoadRibbonCustomTab("MyRibbonTab", SPRibbon.GetCurrent(Page));
base.OnPreRender(e);
}
public void LoadRibbonCustomTab(string tabId, SPRibbon ribbon)
{
if (ribbon == null) return;
ribbon.Minimized = false;
ribbon.CommandUIVisible = true;
if (!ribbon.IsTabAvailable(tabId))
ribbon.MakeTabAvailable(tabId);
}
but every time I get a page load a weird thing just occur, the SPRibbon just shift down and get back to the original place. What I'm doing wrong? Any other optimized/cleanest way to initialize this? Any opinions r welcome!