Question

I have a view item form which contains a custom WebPart for displaying that item. I have no issue with that but the ribbon for the display form looks weird: It contains lots of options that don't apply for the item.

Here is what I mean:

View tab:

enter image description here

Page tab:

enter image description here

I am doing no customization at all to the ribbon; it just appears like that.

What might trigger this?

Was it helpful?

Solution

Managed to remove the buttons from the WebPart. I've stuck this in the WebPart:

protected override void OnInit(EventArgs e)
        {
            Ribbon currentRibbon = SPRibbon.GetCurrent(this.Page);
            foreach (string rid in litsOfRibbonIdsToExclude)
            {
                currentRibbon.TrimById(rid);
            }
}

with litsOfRibbonIdsToExclude an array with "Ribbon.ListForm.Display.Manage.ApproveReject", "Ribbon.ListForm.Display.Manage.CheckIn", "Ribbon.ListForm.Display.Manage.CheckOut", ......

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top