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 am devloping a SP2013 App which includes a page (aspx) that contains the following webpart and XsltListViewWebPart as shown below. I have managed to remove all the elements i want to remove (Toolbar, seaarchbox etc) but I want to specify the view (I have created 4 views for the list) that the list default to but I can see any option to do this?

Anyone achived this?

<WebPartPages:WebPartZone runat="server" FrameType="None" ID="HolidayBalance" Title="loc:HolidayBalance" PartChromeType="TitleOnly" ShowTitleIcons="True" AllowLayoutChange="False">
        <WebPartPages:XsltListViewWebPart ID="XsltListYourHolidayBalance" runat="server" ListUrl="Lists/Personnel Holiday Entitlement"  IsIncluded="True" NoDefaultStyle="TRUE" Title="Your Holiday Balance" PageType="PAGE_NORMALVIEW" Default="True" DisableViewSelectorMenu="True" InplaceSearchEnabled="False" ShowToolbarWithRibbon="False" >

share|improve this question
up vote 7 down vote accepted

If you plan to provision the page using a Module, I'd recommend configuring the web part inside of the Module, rather than in the aspx file itself. This will allow you to select whichever view you would want:

<File Path="mypage.aspx" Url="mypage.aspx" Type="GhostableInLibrary">
  <View List="Lists/Personnel Holiday Entitlement" BaseViewID="4" WebPartZoneID="HolidayBalance" WebPartOrder="1">
              <webPart xmlns="">
                      <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
                      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
                          <property name="Title" type="string">Your Holiday Balance</property>
                          <property name="DisableViewSelectorMenu" type="bool">True</property>
                          <property name="InplaceSearchEnabled" type="bool">False</property>
                          <property name="ShowToolbarWithRibbon" type="bool">False</property>

Note: this example is from SP 2010, hopefully it's applicable and compatible with SP 2013.

share|improve this answer
Hey Rich, thanks for that, have just arrive at the same conclusion! Slightly annoying that my VS intelisense does not seem to work inside <![CDATA[ but at least i can do what i need to do. – Stephen Feb 14 '13 at 17:32
I should have listened, found this a week ago. I changed Version to for SP2013. I also used this… to provision my view correctly and changed the BaseViewID to match. Perfect thanks. – Matthew Radford Jul 17 '14 at 13:47

If you want to change it pro-grammatically check this link out. Where they getting the webpart and then setting it's view.

create or get XsltListViewWebPart

You can change default view in the definition of your list too.

Here's a similar question on SE that explains how to change list's default view in Schema.xml

share|improve this answer
Thanks for the reply...yes I have seen this but I am displaying the list twice on the same page...for 1 list I want to show the default view (all) and in the other list a custom view...Does this mean i need to create two lists containing the exact same content?! – Stephen Feb 14 '13 at 12:47
I see, since you will have 2 webparts and I assume with different titles, then pro-grammatical approach should work as get each webpart using there title. – Muhammad Raja Feb 14 '13 at 12:50
Yip i have two different web parts, its seems crazy i can specify the view in the tags for the XsltListViewWebPart. – Stephen Feb 14 '13 at 12:52

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.