0

I am starting to learn SharePoint App Development for SharePoint 2013 using Visual Studio 2012. I'm going through the walk through found here:

http://msdn.microsoft.com/en-us/library/office/fp142379.aspx

I'm having problems when trying to add the WebPartPages:XsltListViewWebPart element to default.aspx. Here is the code:

<WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2" 
runat="server" ListUrl="Lists/TestCustomList" IsIncluded="True" 
NoDefaultStyle="TRUE" Title="TestCustomList" PageType="PAGE_NORMALVIEW" 
Default="False" ViewContentTypeId="0x"> 
</WebPartPages:XsltListViewWebPart>

I get the error:

Element 'XsltListViewWebPart' is not a known element.

Here is the register line that is added automatically when you create a new SharePoint App Project in VS2012:

<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"  Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Any ideas? Thanks in advance.

6
  • Did you add it to web part zone? Jan 23, 2014 at 20:14
  • I did (see below). What you can't see here is in the editor (VS2012) 'XsltListViewWebPart' has a green line under it indicating that VS can't find a definition for it. <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="full" Title="loc:full" > <WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart2" runat="server" ListUrl="Lists/TestCustomList" IsIncluded="True" NoDefaultStyle="TRUE" Title="TestCustomList" PageType="PAGE_NORMALVIEW" Default="False" ViewContentTypeId="0x"> </WebPartPages:XsltListViewWebPart> </WebPartPages:WebPartZone>
    – Lacarno
    Jan 23, 2014 at 20:49
  • Wait, so you are getting this error only in VS? If you deploy page does it work? This kind of errors could happen in VS. Jan 23, 2014 at 20:51
  • I get the error in VS, but it also won't let me deploy (from within VS). The error I get when I try to deploy is: Element 'XsltListViewWebPart' is not a known element.
    – Lacarno
    Jan 23, 2014 at 20:53
  • Are you developing on sharepoint server? Also is your XsltListViewWebPart tag located in asp:content tag? Jan 23, 2014 at 21:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.