1

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?

  • I guess that just comes from the base your webpart is build on. Kind of out-of-the-box features with this type of webpart. Did you build this custom WebPart by using a blank one and adding functionality? Did you try different ootb webParts? Did they look different? – Shegit Brahm Feb 10 '12 at 15:07
  • @Shegit Brahm : I see where you are going... I'm extending a DataFormWebPart; If I use a classic ListFormWebPart for example (can't extend that as it's sealed) I get a normal ribbon. I guess ListFormWebPart is doing something to the ribbon. Will have to check that out... – JohnDoDo Feb 10 '12 at 15:37
1

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", ......

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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