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.
<li class="clearfix"> <a class="thumb" ID="thumnailLink"> </a> <h2></a></h2> <span class="date"> </span> </li> Geen artikelen <ul ID="itemPlaceholderContainer"> <li ID="itemPlaceholder" /> </ul> <br /> <ul> <li class="paging"> </li> </ul>
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.
I think Format="MM-dd-yyyy" is better than Format="dd-MM-yyyy"..
The date format I use is the correct format for culture "nl-NL" (The Netherlands).