I needed to display a news feed from an xml file. My original intentions were to use XML & XSL to tranform into html but i needed paging support.
I looked at the XMLData Source control and there isno paging support built onto this control. After a look around I came across a .NET class called PagedDataSource. This class abstracts the paging functionality that is used in data grids etc.
All you have to do is load the XML into a dataset, load the pageddatasource with the data from the dataset, set the paging on, set the page index and items per page. Voila! This can now be bound to any control that supports data binding. Wicked!
Here is some sample code binding it to a DataRepeater.
Dim ds As New DataSet
Dim pagedData As New PagedDataSource
Dim dv As New DataView(ds.Tables(0))
dv.Sort = "SortDate DESC"
pagedData.DataSource = dv
pagedData.AllowPaging = True
pagedData.PageSize = ItemsPerPage
pagedData.CurrentPageIndex = CurrentIndex
xmlRepeater.DataSource = pagedData
btnBack.Visible = Not pagedData.IsFirstPage
btnMore.Visible = Not pagedData.IsLastPage