Learning Resources
 

Using the ItemSeparatorTemplate


Use the ItemSeparatorTemplate property to define the contents of the separator between single items of the ListView control. The ItemSeparatorTemplate is displayed after every item except the last one.

To specify the custom template declaratively, add an ItemSeparatorTemplate element inside the ListView control. You can then add the contents of the template to the ItemSeparatorTemplate element.


The following example shows how to create an item separator in the ListView control by using the ItemSeparatorTemplate property.


<%@ Page language="C#" %>

    "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


 
    ListView Tiled Layout Example
   
 
 
   



     

ListView Tiled Layout Example



              DataSourceID="ProductsDataSource"
        GroupItemCount="2"
        runat="server">
       
         
           
             
           
           
         
PRODUCTS LIST

       

       
         
           
         
       

       
         
           

         
       

       
         
                           Text='<%# Eval("Name") %>'
             NavigateUrl='<%# "ProductDetails.aspx?productID=" + Eval("ProductID") %>' />

                           ImageUrl='<%# "~/images/thumbnails/" + Eval("ThumbnailPhotoFileName") %>' />

            Price:
           

         
       

       
           
       

     

     


              PagedControlID="ProductsListView">
       
                      ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false" />
         
                      ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false" />
       

     


     
     
     
     
              ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice,
          PF.ThumbnailPhotoFileName
          FROM Production.Product AS P
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID">