Display Ribbon Anywhere

Add-in Express™ Support Service
That's what is more important than anything else

Display Ribbon Anywhere
Requirement to display a SharePoint 2010 Ribbon on a custom .aspx page deployed to SharePoint. 
This forum has moved to a new location. From now on, please post all your questions about Ribbon Designer for SharePoint on this forum.
Ashley Camidge




Posts: 1
Joined: 2012-01-17
My existing SharePoint solution contains many custom pages deployed to _layouts/Pages.

I am having some difficulty getting my Ribbon (created through the designer) to display at all.

I have a contextual tab group currently containing a single tab with a single group and one button (the simplest thing I could think of while still using a contextual tab).

Depending on the page I'm viewing I want to be able to display certain areas of the ribbon (using an AdditionalPageHead control similar to that provided out of the box with the designer).

I have so far only been able to display my simple Ribbon on a list view page (which isn't what I need at all).

Can someone please point me in the right direction to help me display my Ribbon wherever I want.

Thanks in advance,

Ashley.
Posted 17 Jan, 2012 16:01:56 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Ashley,

As far as I understand you need to show your own contextual tab for particular pages only and show/hide groups depending on which page is loaded at a given moment. If so, please try to do the following:
1. Set the Visible property of your ADXSPRibbonContextualGroup component to true.
2. Set the Ribbons property of your ADXSPRibbonTab component to DisplayForm.

In this way you will have your contextual tab loaded and shown for all simple pages like WikiPage and custom pages.

3. Handle the OnLoad event and show or hide your groups depending on a certain page:

private void SPRibbon1_OnLoad(object sender, System.Web.UI.Page page)
{
    // make the tab invisible
    this.adxspRibbonTab1.Visible = false;

    // is it page1?
    if (page.Request.FilePath.IndexOf("Test1.aspx") > 0)
    {
        // make the tab visible
        this.adxspRibbonTab1.Visible = true;
        // hide and show groups
        this.adxspRibbonGroup1.Visible = true;
        this.adxspRibbonGroup2.Visible = false;
    }

    // is it page2?
    if (page.Request.FilePath.IndexOf("Test2.aspx") > 0)
    {
        // make the tab visible
        this.adxspRibbonTab1.Visible = true;
        // hide and show groups
        this.adxspRibbonGroup1.Visible = false;
        this.adxspRibbonGroup2.Visible = true;
    }
}


This will let you show your tab and group for a particular page only. Does this approach suit your needs? If you need something else, please let me know.
Posted 18 Jan, 2012 05:01:45 Top