| |

VerySource

 Forgot password?
 Register
Search
View: 1308|Reply: 9

How to use GridView for efficient page turning?

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-2 23:10:01
| Show all posts |Read mode
For example, turning over a large amount of data. Relying on the page turning function that comes with GridView itself seems to be very inefficient, it can't be used. thank you very much! !! !! !!
Reply

Use magic Report

0

Threads

13

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-3 16:00:01
| Show all posts
You can use this paging control: http://www.iceice930.com
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-3 17:21:01
| Show all posts
My usual approach is to return the required records and the total number of eligible records in the data layer.
Then customize a page navigation control to display the corresponding page number!
The following is a code snippet of my data layer when paginating. Based on SQL 2005

            StringBuilder strSQL = new StringBuilder ();
            strSQL.Append ("SELECT * FROM (");
            strSQL.Append ("SELECT ProductID, ProductNO, CategoryID, CategoryTitle, ProductName, MarketPrice, MemberPrice, ProductParams, Description, ImagesCount, CreateDate, ROW_NUMBER () OVER (Order By ProductID Desc) AS RowNum from Product");
            strSQL.Append (") AS T WHERE RowNum BETWEEN @StartRow AND @EndRow");
            IList <ProductInfo> tList = new List <ProductInfo> ();
            SqlParameter [] parameters = {
        new SqlParameter ("@ StartRow", SqlDbType.Int),
        new SqlParameter ("@ EndRow", SqlDbType.Int)
            };
            parameters [0] .Value = (index-1) * pagesize;
            parameters [1] .Value = index * pagesize;
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-28 11:15:01
| Show all posts
ROW_NUMBER () OVER (Order By ProductID Desc) AS RowNum from Product

How can I not understand this sentence. .

What does ROW_NUMBER () mean?
And what does the OVER function mean?
Reply

Use magic Report

0

Threads

26

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-3-29 09:45:02
| Show all posts
I heard that stored procedure paging is more popular, and even large volumes can handle it.

Is GridView pagination slow? No ~~~ I tested hundreds of thousands of data and it was very fast.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-5 11:00:02
| Show all posts
The paging principle of GridView is to read all the data into the DataSet, and then paging. Isn't this a huge waste? If the stored procedure turns pages in ACCESS, will it not work? Should be written to the program, then How to write?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 07:45:01
| Show all posts
LZ is in Haixi?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 08:00:01
| Show all posts
I suggest you all take a look at http://www.cnblogs.com/白猪天使/MyPosts.html here to introduce the NicPetShop article

Paging performance is better here, using row_number()
And with a lot of extension methods
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 08:30:01
| Show all posts
Stored procedure or paging control
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 14:45:01
| Show all posts
The paging function of GridView is very slow
Bind the data source yourself
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list