MSDN "Walkthrough: Use Web Forms Creating Patement Data Access" One's Optimization

xiaoxiao2021-03-06  64

If you have MSDN installed, you are learning to use the .NET production website, and maybe you will touch such an example document:

Visual Basic and Visual C # Concept

Walkthrough: Creating Patement Data Access Using Web Forms

MS-help: //ms.vscc.2003/ms.msdnqtr.2003feb.2052/vbcon/html/vbwlkwalkthroughdisplayingdatainListBoxesonWebformSpage.htm

The text tells how to make a list of data with custom paging, this method is very good for large-scale data tables at a list of large-scale data tables each time, this way is displayed only from the database. The scheduled scheme is better after all data is removed.

I found a few small bugs when using this program, as follows:

In the "next target" program code, private void btnNext_Click (object sender, System.EventArgs e) {// Get the page number of the page most recently displayed CurrentPage = (int) (ViewState [ "CurrentPage"] ); CurrentPage ; // gets the ID on current page string lastid = dataGrid1.items [9] .Cells [0] .text; cmdnext.parameters ["@ Customerid"]. Value = LastID; FillGrid (cmdnext);} red word The part should be changed to "string lastid = DataGrid1.items [dataGrid1.pagesize-1] .Cells [0] .Text;", otherwise the number is not a default 10, may cause an error. In addition, in the "display data in the grid", you will see some code is to determine that the number of strips taken when this page is less than PageSize, that is, when it is considered to be the last page of the data table, set "next Page button invalid, and should also be added to the first page of the current page 0 or less, that is, when it is considered to be the first page of the data table, set the "Previous" button to fail, as follows: if (DataGrid1.Items. Count

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

New Post(0)