In the previous article, we wrote the ListView Big Data paging processing, which mainly described the paging processing idea. This article mainly makes some changes to the page control ListViewPager in the previous article, allowing him to automatically bind pages. ListViewPager provides open usage, while ListViewPagerEx provides DataSource, ListView, BindedColumns, and other attributes to turn off the page turning event, making it easier to use.
Class Name: ListViewPagerEx
Attribute:
ListView // The ListView to which the object belongs
DataSource // prepare the able displayed on the ListView
BindedColumns // bind it to the column index array in the corresponding DataSource on the ListView. If no value is assigned, the DataSource is bound to the column in the order of its columns by default.
Public method:
Start (); // make the ListViewPagerEx control take effect
GetListViewPageRecordNum (ListView); // gets the maximum number of data entries displayed on each page of ListView.
Usage:
Create a new Form, drag the ListView control and ListViewPagerEx control, set the ListView View-> Details, FullRowSelect-> True, set the column, and then set the ListView attribute of the ListViewPagerEx control, set it to the ListView of the current Form.
Add method InitForm (); // In this method, construct/or retrieve a data table able, set the DataSource attribute of ListViewPagerEx to this DataTable, and then add the following sentence: listViewPagerEx1.Start. Of course, the column sequence of ListView is inconsistent with that of DataTable. You can use the BindedColumns attribute for ing.
Download the source code and test demo.
The code is completed in vs2003 and can be directly transplanted to vs2005.