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

I have a page that I'm provisioning in Visual Studio 2010 through a module. In my elements.xml I have a <File> element with a <View> element underneath like this:

<File Path="TemplatePage.aspx" Url="Edit_Pages/Links.aspx" Type="GhostableInLibrary" >    
  <View List="Lists/Links" BaseViewID="1" WebPartZoneID="Left" WebPartOrder="2" />

The view looks at a list of links. Everything goes fine with the provisioning but when I go to the page and click on the webpart the "Change Item Order" option under the ribbon "List Tools -> Items" is disabled. However, if I go to the list directly through "View All Site Content", the option is enabled. My question is "How can I enable the Change Item Order button?".

Change Item Order Disabled

share|improve this question
up vote 3 down vote accepted

I found a technique to set the "Allow users to order items in this view?" property for the webpart. I call this method from the feature receiver of my provisioning feature. The key is setting the XsltListViewWebPart.ViewFlags to include SPViewFlags.Ordered. Here is the forum entry answer by Porter Wang which led me to my solution.

SPList list = web.Lists[listName];
SPFile file = web.GetFile(pageUrl);

SPLimitedWebPartManager webPartManager = 

XsltListViewWebPart selectedWebPart = (XsltListViewWebPart)
  (from Microsoft.SharePoint.WebPartPages.WebPart webPart in webPartManager.WebParts
   where webPart is XsltListViewWebPart && webPart.ZoneIndex == webPartZoneOrder
   select webPart).FirstOrDefault();

if ((selectedWebPart.ViewFlags & SPViewFlags.Ordered) == 0)
  selectedWebPart.ViewFlags = selectedWebPart.ViewFlags | SPViewFlags.Ordered;


share|improve this answer

That option is enabled normally only on Links and Meeting Workspaces. E. Struyf has an excellent series on how to customize any list to support it here For a list instance based on the TemplateType=103 (LINKS)

<ListInstance Title="Global Links"
                Url="GlobalLinks" RootWebOnly="TRUE"
                Description="Use this list to store links with Global scope"/>

Inserting a ListView while provisioning the page should be achieved like this

<View BaseViewID="9" List="GlobalLinks" WebPartZoneID="Left" WebPartOrder="1" DisplayName="Global Links" >
          <WebPart xmlns="">
              <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
              <Title>My Requests</Title>
              <NoAnnouncements>You have no links available.</NoAnnouncements>

share|improve this answer
This IS a "Links" list. That's why it works automatically when I go to the list from the "View All Site Content" page. However, I'm putting the list on another page as well and I would like the user to be able to do it there. – skeletank Apr 25 '12 at 17:13
If you use the OOTB ListView web-part in a page you should get this functionality in the Ribbon under the Items tab (as usual) - just checked (you need at least 1 item)! I've added to my answer an example of the List Instance for Links! – Marius Constantinescu - MVP Apr 25 '12 at 17:20
Sorry, I just added my xml to my question. As you can see I'm using my own page with a view of the list in addition to the page that is automatically provisioned when you use the xml from the answer you provided. – skeletank Apr 25 '12 at 17:29
I use the 1st bit to create a list instance which can be used in features. The 2nd part of the code, shows how you can provision via Module a page with a View embed in it (which I believe your intention is). – Marius Constantinescu - MVP Apr 25 '12 at 17:36
My example in the question also provisions via Module a page with an embedded view. Have you tested your version to make sure that "Change Item Order" is available on that provisioned page? I'm not meaning to be rude but I was wondering what the difference between mine and yours would be that allows yours to see that option. When I look at the view for my webpart the "Allow users to order items in this view?" option is set to "No" after provisioning. – skeletank Apr 25 '12 at 17:40

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.