Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Try this:

public void LoadRibbonCustomTab(string tabId, SPRibbon ribbon)
{
        if (ribbon == null) return;
        ribbon.Minimized = false;
        ribbon.CommandUIVisible = true;

        if (!ribbon.IsTabAvailable(tabId))
            ribbon.MakeTabAvailable(tabId);

        ribbon.InitialTabId = tabId;
}
share|improve this answer
    
actually, I have already tried like that, but it gets even worst. It gets MyRibbonTab selected, yes, but right bellow it the 'Browse' Tab also open. in other words, a mess! but thanks a lot for the reply –  fallout Apr 10 '12 at 12:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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