Limit number of records with XmlDataSource in Repeater or any data control

By SP

If you are using an RSS to bind to repeater or any other control and want to limit the number of records, this will help you.

If you are using a XmlDataSouce to bind the data to Repeater or any other data control and you want to limit the number of records to show, then you can use XPath property of your XmlDataSource

like this

XmlDataSource1.XPath = "//rss/channel/item[position() < 10]"; // This will give you 9 records

or

XmlDataSource1.XPath = "//rss/channel/item[position() > 3 and position() < 10]"; // This will give you 6 records

Hope this helps.

Limit number of records with XmlDataSource in Repeater or any data control  (1129 Views)