I am in the process of makeing a small script that will take all files from a pre-defined folder on the server, list them, sorted by name, with a pager and a way of grouping them by [A], [B] etc. navigation.
My thoughs were to loop through all the files and put them in a Array/List/Directonary (?) and then make a Gridview/Datagrid/Listview (?) to show the files, and handle the default paging.
Looking for inputs on the best way to achieve this based on the above – any inputs and/or snippets/examples would be much appreciated.
If you want more flexibility this is easy to do with LINQ.
De/Incrementing pageNum on each next/prev (just make sure you take 0 & the max page num into consideration).
You can also include other linq operations like
orderby,where,select,groupby,join, etc.From your comment:
In the above example you can call methods on currentPage like
.ToArray()/.ToList()/.ToDictionary()in order to form the data into the collection that best suits your needs.An example using System.Windows.Forms.ListView:
Order the items, convert them to an array of ListViewItem and then use AddRange() on the list view’s item collection to add them to it.