kamagra how much to take

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:

  1.  protected override void OnPreRender(EventArgs e)
  2.         {
  3.             SPRibbon ribbon = SPRibbon.GetCurrent(Page);
  4.             if (ribbon != null)
  5.             {
  6.                 ribbon.Minimized = false;
  7.                 ribbon.CommandUIVisible = true;
  8.                 const string initialTabId = "[Put your tab ID here]";
  9.                 if (!ribbon.IsTabAvailable(initialTabId))
  10.                 {
  11.                     ribbon.MakeTabAvailable(initialTabId);
  12.                 }
  13.                 ribbon.InitialTabId = initialTabId;
  14.             }
  15.             base.OnPreRender(e);
  16.         }

easy peasy.

Share

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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>