Click here to Skip to main content
15,843,031 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Datagrid and there may be 1000 of rows in it. Based on a filter (combobox), Datagrid is filled with number of rows. So loading numbers of entries taking time till then my UI gets irresponsive.

My question is
1)Is 'Visibility' property stops the control to draw? If no then which property can be used?
2)Can you please suggest any approach to do that?

What I have tried:

I tried to use "Visibility" property for rows so that datagrid can show only visible those rows which are in visible client area. But this trick did not work.
Updated 26-Sep-20 23:59pm
Gerry Schmitz 25-Sep-20 12:51pm    
Without seeing code, hard to suggest. Like drinking out of cup or sucking a straw; both work but with different efficiencies. And 1000 is not "a lot"; depends on how you go about it. The implication is that there are no "1000 row" Excel spreadsheets either even though the limit has never been less than 64,000 rows. And one doesn't scroll one row at a time with more than a few rows: one "pages".

Basically, don't do it.

What do you expect the user to do with 1000 rows of data? How do you expect them to find the row they are interested in?

Don't just dump data on a user: it makes you app difficult to use and that means users won't use it - they will find an alternative that has a better design and use that instead.

Keep data to a minimum: that speeds display and makes the UI more approachable. Page data, filter it, search it: help the user to do their job, not dump data on them and expect them to do yours!
Share this answer
Visibility isn't really going to help you here.

Are you binding the grid to the data or are you adding each row of the dataset to the grid yourself? The later will take longer.

But, the major issue is you're adding a LOT of data to the grid. Having the user scroll through a thousand records is just go to piss users off. So you have to limit the data you're retrieving. Instead of returning as many rows as possible, change the database SELECT query to return the TOP 100 rows instead. You can let the user know the returned dataset is too large if you check the number of rows returned by the query and enable/disable such a UI notification to the user.
Share this answer
JM2251 28-Sep-20 0:45am    
Thanks for your reply.
Yes, I am using itemsource of Datagrid for items. I dont want to give data in slots. I want to display without slots.

Now queries are:
1) If visibility dont stop the control to draw. Is there any property to do the same?
2) Can you provide any link for data virtualtion so that I can show only numbers of rows which are visible and load another row when user scolls.
Try this link,
how to fill datagridview with thousand of records quickly ?[^]
where is also my solution of such problem.

All the best,
Željko Perić
Share this answer
Richard MacCutchan 27-Sep-20 6:37am    
It's still a very bad idea.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900