SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The situation is the following. I'm creating an XsltListViewWebPart during the Page LifeCycle which is added to the page Controls collection (or UserControl Controls collection). The XsltListViewWebPart is displayed as expected. The only problem is that when an item is selected, the "List Tools" ribbon tab is not available (not visible).

XsltListViewWebPart lvwp = new XsltListViewWebPart();    
SPWeb thisWeb = SPContext.Current.Web;
SPList list = thisWeb.GetList(SPUtility.ConcatUrls(thisWeb.ServerRelativeUrl, "lists/" + listName));
SPView view = list.DefaultView;
lvwp.ListId = list.ID;
lvwp.ViewGuid = tabView.ID.ToString("B").ToUpperInvariant();
lvwp.ItemContext = SPContext.GetContext(this.Context, view.ID, list.ID, thisWeb);
lvwp.ShowToolbarWithRibbon = true;    

What am I missing?

share|improve this question
Did you manage to solve this? I'm currently having the same problem. Gary. – user6766 Feb 7 '12 at 10:48

I found that the only way to show XsltListViewWebPart ribbon is to add dynamic created webpart to:

<WebPartPages:WebPartZone runat="server" ID="MainZone">


share|improve this answer

Is your webpart toolbar mode configured as Full? I suppose it may be the case - SharePoint doesn't apply the Ribbon customizations to the list if the webpart toolbar is in Summary mode. Unfortuntely I don't know how to set it programmatically - just point the direction.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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