DataGrid Control (2) - Page

zhaozj2021-02-16  46

After the data binding, if you want to implement a paging function in the DataGrid control, you will use the dataGrid's sopaging property, set the allowpaging property to true, then set the size of each page, such as 2: Pagesize = 2. At this time, then run the program, you will see that DataGrid is displayed in the way each page records, and "<" and ">" are connected to the previous page or next page, if you don't want to use this " <"And"> ", and want to use Chinese characters" Previous "and" Next ", then as long as you set this in the property:

PagersTyle-nextpagetext = "Next" PagersTyle-prevpagetext = "Previous"

If you run the program, you will see the "Previous Page" and "Next Page" of the link. If you want to display the "Previous" and "Next" on the right, then as long as the setting:

Pagerstyle-horizontalalign = "right"

Also, to reach the purpose of clicking "Previous" and "Next" to turn the page, set it:

OnpageIndexchanged = "DataGrid1_pageIndexchanged"

We write code in the DataGrid1_pageIndexchange process:

Sub DataGrid1_pageIndexchanged (Byval E AS Object, BYVAL E AS DataGridPageChangeDeventargs) DataGrid1.currentPageIndex = E.NewpageIndex DataGrid1.database () End Sub

At this point, we have completed the simple paging of DataGrid. Of course, there is a lot of ways of paging, I will release it in the future documentation.

转载请注明原文地址:https://www.9cbs.com/read-22610.html

New Post(0)