How to embed listview webpart within a DIV in my custom .aspx page. RRS feed

  • Question

  • Hi,

    Please let me know how to embed a listview webpart within a DIV in my custom .aspx page?

    I am a beginner in sharepoint. I have a list with name modeldata and i just want to embed list view webpart of modeldata in my custom page located at a document library.

    <%@ Page language="C#" MasterPageFile="~masterurl/default.master"    Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document"  %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
    <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
    <%@ Import Namespace="Microsoft.SharePoint" %> 
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

    Body of my page


        <div class="col-sm-8 text-left"> 
          <h1>Model Config: Webpart View</h1>
          <div class="well">
              <!--Webpart starts-->
                 <WebPartPages:WebPartZone ID="TopZone" runat="server" Title="Top" AllowPersonalization="False" AllowCustomization="False" AllowLayoutChange="False">

     <!-- I want to insert webpart here. What should i place here, give an example -->

              <!--Webpart ends-->


    Thursday, March 2, 2017 1:00 PM

All replies

  • May be you can drop your web part on SharePoint page and then open that page in SharePoint designer. This way you will be able to get the web part code which you can try injecting on your page.

    if you are new to SPD then check the following article.


    Thursday, March 2, 2017 1:30 PM
  • I have injected the webpart code but nothing showing.

    <div class="col-sm-12">

    <WebPartPages:WebPartZone runat="server" Title="loc:FullPage" ID="FullPage" FrameType="TitleBarOnly">





    Is there any references or additional requirements?


    Monday, March 6, 2017 8:58 AM
  • hello,

    the idea is that at first you will add web part on your page from UI, not from Sharepoint Designer (i.e. in browser go to your page, click Site actions > Edit page > add needed list view web part > publish the page). After that web part will be on your page and if you will need to do further customizations, open this page in Sharepoint Designer and detach page from page layouts - after that you will see your web part code added on the page.

    Blog -
    Dynamic CAML queries via C# -

    Monday, March 6, 2017 10:33 AM