Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 29th, 2007, 03:44 PM
Authorized User
 
Join Date: Jun 2006
Location: Chelmsford, MA, USA.
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
Reply With Quote
  #2 (permalink)  
Old August 30th, 2007, 08:12 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
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
================================================== =========
Reply With Quote
  #3 (permalink)  
Old August 30th, 2007, 09:22 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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

================================================== =========
Reply With Quote
  #4 (permalink)  
Old August 30th, 2007, 09:28 AM
Authorized User
 
Join Date: Jun 2006
Location: Chelmsford, MA, USA.
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
Reply With Quote
  #5 (permalink)  
Old August 30th, 2007, 09:33 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
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
================================================== =========
Reply With Quote
  #6 (permalink)  
Old August 30th, 2007, 09:50 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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

================================================== =========
Reply With Quote
  #7 (permalink)  
Old August 30th, 2007, 09:51 AM
Authorized User
 
Join Date: Jun 2006
Location: Chelmsford, MA, USA.
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?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.