Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 29th, 2007, 03:44 PM
Authorized User
 
Join Date: Jun 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default GridView Performance

Hi,

I am using following method to fill Gridview. The performance is too slow. What is the best way to fill GridView to increase performance.

        Dim cmd As OracleCommand, dt as new datatable
        cmd = dbCommand(conn, sSql)
        Dim a As New OracleDataAdapter(cmd)
        Dim dt As New DataTable
        a.Fill(dt)
        GridView.DataSource = dt
        GridView.DataBind()

Any help is appreciated.

Thanks
__________________
Rams
 
Old August 30th, 2007, 08:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. the method you are using is the correct.. what do you mean by slow?? if you try to fill the grid with a lot of data it will be slow...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old August 30th, 2007, 09:22 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

How many rows of data are you trying to load into the GridView?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 30th, 2007, 09:28 AM
Authorized User
 
Join Date: Jun 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, filling 10k rows and pagesize is 20 and when user click on page 2, 3, 4 and so on, its taking time to fill 10k rows in datatable and to grid.

Is there any best method for this, i mean instead of filing 10k rows each time when user click on each page.

Is datareader is faster than datatable? Infact, i don't need datatable to populate grid. Can we populate grid using datareader? Is it faster than datatable?

Thanks
 
Old August 30th, 2007, 09:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

is paging enabled on the grid?? then is not filling all the records on the grid, only the actual page.. so maybe there is other things that made the page slow??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old August 30th, 2007, 09:50 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I had a similar situation to this although my total record count was 68K rows. In my particular situation I was working with Client Data so was able to circumvent this problem by setting up a 'Tab' type system so that the grid loaded clients whose last name began with A, B, C, D etc based upon which tab was clicked.

What I might first suggest is see if it is the amount of data you are trying to bring forward or if you have some other on page elements working against you. So execute a query that will only return you, say, 50 rows of data from your entire result set. If this speeds things up you are simply loading to much data into the grid for it to be effecient.

If this does not speed things up you have something else that is slowing you down.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 30th, 2007, 09:51 AM
Authorized User
 
Join Date: Jun 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you r correct, paging is enabled.

I observed that its taking time to fill datatable.

Instead of loading data in datatable, can we load grid from datareader? Is that fast?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Performance prasanta2expert SQL Server 2000 6 December 15th, 2006 10:38 PM
Performance prasanta2expert ASP.NET 1.0 and 1.1 Basics 0 December 4th, 2006 04:24 AM
Performance Penalty for Custom Code Gridview Row B wirerider ASP.NET 2.0 Professional 0 April 5th, 2006 04:43 PM
what is the best to do, better performance alyeng2000 ASP.NET 1.0 and 1.1 Basics 1 December 13th, 2003 07:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.