locked
set customize tab as default tab in sharepoint 2010 ribbons RRS feed

  • Question

  • hi .

    I create new custom tab for SharePoint2010 ribbon . I want when ribbon load , my custom tab in selected as default .

    I searched it in Microsoft forum and found this code :

    class TabLoader : System.Web.UI.WebControls.WebControl { protectedoverridevoid OnPreRender(EventArgs e) { SPRibbon ribbon = Microsoft.SharePoint.WebControls.SPRibbon.GetCurrent(this.Page); if (ribbon != null) { ribbon.Minimized = false; ribbon.CommandUIVisible = true; conststring initialTabId = "Ribbon.CustomTabExample2"; if (!ribbon.IsTabAvailable(initialTabId)) ribbon.MakeTabAvailable(initialTabId); ribbon.InitialTabId = initialTabId; } base.OnPreRender(e); } }

    but i don't know how use it in my project .

    please guide me .

    Wednesday, August 29, 2012 8:20 AM

Answers

  • hi

    create a webpart

    paste that code in webpart  cratechildcontrols or OnPreRender

    add your webpart to your page


    yaşamak bir eylemdir

    • Proposed as answer by Hemendra Agrawal Wednesday, August 29, 2012 9:15 AM
    • Marked as answer by Lhan Han Tuesday, September 4, 2012 10:45 AM
    • Unmarked as answer by Mohammad Modrek Tuesday, September 4, 2012 12:17 PM
    • Marked as answer by Mohammad Modrek Tuesday, September 4, 2012 12:44 PM
    Wednesday, August 29, 2012 8:37 AM

All replies

  • hi

    create a webpart

    paste that code in webpart  cratechildcontrols or OnPreRender

    add your webpart to your page


    yaşamak bir eylemdir

    • Proposed as answer by Hemendra Agrawal Wednesday, August 29, 2012 9:15 AM
    • Marked as answer by Lhan Han Tuesday, September 4, 2012 10:45 AM
    • Unmarked as answer by Mohammad Modrek Tuesday, September 4, 2012 12:17 PM
    • Marked as answer by Mohammad Modrek Tuesday, September 4, 2012 12:44 PM
    Wednesday, August 29, 2012 8:37 AM
  • thanks a lot Ilker Alizat
    Wednesday, August 29, 2012 8:49 AM
  • hi

    If my answer do not meet your needs please explain.


    yaşamak bir eylemdir

    Tuesday, September 4, 2012 12:26 PM
  • hi.

    thanks Ilker . It's working good .

    Tuesday, September 4, 2012 12:46 PM