[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

POPULATE GRIDVIEW VIA DATAREADER - PAGING

Posted on 2007-10-14
7
Medium Priority
?
925 Views
Last Modified: 2012-05-05
I know that you cannot implement paging in a gridview that is populated via a datareader but say you have 15,000 rows can you specify the grid to display 20 rows per page?  I need to loop through all the rows of the gridview which maybe 15000 or so but need to display the gridview in pages.
0
Comment
Question by:mugsey
  • 3
  • 2
  • 2
7 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20073701
http://www.codeproject.com/useritems/DataGridPaging_DataReader.asp

This article explains how to manually implement pagination in a datagrid that is bound to a datareader
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 20073979
>> I know that you cannot implement paging in a gridview that is populated via a datareader

You canot what ??? You talking about gridview or datagrid ?

If it is gridview from VS2005 it's an easy strep.
0
 

Author Comment

by:mugsey
ID: 20084302
I am using a GRIDVIEW but using a datareader can you implement paging?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:surajguptha
ID: 20090072
mugsey, did u check out the link i sent u?
0
 

Author Comment

by:mugsey
ID: 20107526
Yes thanks but I need it for ASP.NET not windows forms.  I think I will use a dataset - have you a good example of this?  
You see, say if I have 20,000 rows, and allow the gridview to display say 20 rows per page, can I still iterate through all of the 20,000 rows?

0
 
LVL 21

Accepted Solution

by:
surajguptha earned 2000 total points
ID: 20108808
>> You see, say if I have 20,000 rows, and allow the gridview to display say 20 rows per page, can I still iterate through all of the 20,000 rows?

You would be able to bind the grid to display only 20 rows but you can iterate through the dataset that contains 20,000 rows

>> Pagination in asp .net
http://aspnet.4guysfromrolla.com/articles/091003-1.aspx
http://www.thescripts.com/forum/thread286649.html
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 20109803
Why dont you use something like this :

Private Const myConnectionString As String = "Data Source=.\SQLEXPRESS;AttachDbFilename='|DataDirectory|\myData.MDF';Integrated Security=True;User Instance=True"

    Public Shared Function FillGridView(ByVal gv As GridView, ByVal SQL As String) As Boolean
        Dim ds As New SqlDataSource

        With ds
            ds.ConnectionString = myConnectionString
            ds.SelectCommand = SQL
        End With

        gv.DataSource = ds
        gv.DataBind()
    End Function
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question