Saturday, 18 April 2015

Add SharePoint ListView in Page


We can easily add list view in .aspx Page , without adding UserControl and Visual WebPart pages.

Add the following code in .aspx page.

<asp:Content ID="Content1" ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
   ListView
</asp:Content>

<asp:Content ID="Content2" ContentPlaceholderID="PlaceHolderMain" runat="server">
             <WebPartPages:WebPartZone ID="WPListview" runat="server" >
        <ZoneTemplate>
        </ZoneTemplate>
    </WebPartPages:WebPartZone>
</asp:Content>

In Elements Add the following code.

<File Path="Module1\ListView.aspx" Url="view.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
      <View BaseViewID="2" Type="HTML" List="Lists/Testlist" DisplayName="TestView" Name="TestView" DefaultView="TRUE" WebPartZoneID="WPListView" WebPartOrder="1" />

No comments:

Post a Comment