Windows Develop Bookmark and Share   
 index > Windows Forms General > How to Populate the chunk of data (100 rows) each time to Datagrid when the user scrolls through the list of Millions rows?
 

How to Populate the chunk of data (100 rows) each time to Datagrid when the user scrolls through the list of Millions rows?

I would like to achieve this with Datagrid.

I have a datagrid with a table and set of columns.

The dataset I dynamically generate may contain 10000 through 1000000 rows.

I wanted to populate 100 rows first, and when the user navigates to 100th row
and then goes next record, i wanted to populate or add next 100 rows to the datagrid
and so on like this. I also have a scroller. If the user uses to scroller to reach
the bottom of the first 100 rows, I wanted to add or populate next 100 rows.

I know how to fetch 100 rows from my query, but do not know the event that fires
at the end of datagrid row or the scrollbar event

What event of the datagrid or scroll bar should I write my next 100 row fetch.

Any help is appreciated very much.

Thanks in advance.

Jil

J A Y  Tuesday, September 13, 2005 7:56 AM
I don't know of a way to do this. The DataGrid (or DataGridView) controls are not designed with paging in mind, so doing this will require a lot of work listining for scroll event to know when to load more data. If paging is a specific requirement then I'd suggest using a 3rd party grid that supports this out of the box

-mark
DataGridView Program Manager
Microsoft
This post is provided "as-is"
Mark Rideout  Monday, September 19, 2005 9:15 PM
Any Help or pointers to this issue, please?
J A Y  Tuesday, September 13, 2005 3:15 PM
My initial thought would be to change the SQL statement being used to select the TOP 100 records and use a where clause so that it is greater than the last ID currently being displayed.

So something like.

SELECT TOP 100 ID, Name
FROM BusinessCodes
WHERE ID> @ID

and when you get to row 100 you re-execute the procedure to populate the dataset passing in the @ID of 100 and it should pick up 101 - 200.   At which point on you pass @ID of 200 to the call and get 201 - 300.

This should be used on the call to the method used to populate the dataset.

Then you simply need to find the event which you want to fire the repopulate on something like the   DataGridView1_RowEnter event


Just an idea !!!
spotty  Tuesday, September 13, 2005 4:09 PM
Thanks spotty , limiting the query will not do as I am writing this program for the users to execute query. I can not decide what they look at it or what is their query. I need to find out the event to fix it. Thanks again for your response.

Jil
J A Y  Wednesday, September 14, 2005 6:13 AM
Any clue/Hint Please. Jil
J A Y  Thursday, September 15, 2005 7:19 AM

Experts!, Help Please.

J A Y  Friday, September 16, 2005 5:50 AM
I don't know of a way to do this. The DataGrid (or DataGridView) controls are not designed with paging in mind, so doing this will require a lot of work listining for scroll event to know when to load more data. If paging is a specific requirement then I'd suggest using a 3rd party grid that supports this out of the box

-mark
DataGridView Program Manager
Microsoft
This post is provided "as-is"
Mark Rideout  Monday, September 19, 2005 9:15 PM
That resolved my puzzle! I am new to vc++ .net trying to learn from unix c++ background.

Thanks Mark Rideout.

Jil

J A Y  Tuesday, September 20, 2005 9:30 AM

You can use google to search for other answers

Custom Search

More Threads

• Capturing Panel as Bitmap using VS 2003 C#
• Printing
• reconnect...
• How to intercept a keyboard input on a form regardless of the focus of the control?
• Print Events being called twice.
• label
• Messagebox does not show when using barcode wedge scanner
• word 2007 UserControl
• How To Implement Append, Insert and Delete on a Text Editor.
• Focusing on a java applet c#