Pieter Brinkman

Sitecore: itemlist with ObjectDataSource, Listview and DataPager

1 min readpieterASP.NetControls

For a new project I started working with Sitecore again. I needed to create a listing of items with paging. I implemented a Listview with a ObjectDataSource and the DataPager control.

-                                                        
    
                                            
                Geen artikelen

In the code behind I created the public method GetItems which returns a ChildListCollection.

namespace MyNameSpace {
    public partial class MyUsercontrol: System.Web.UI.UserControl     {
             public Sitecore.Collections.ChildList GetItems()        {
          return Sitecore.Context.Item.GetChildren();
        }
     }
}

The PagedControlID property of the datapager control is set to the ID of the Listview.