• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 495
  • Last Modified:

how to make my application .NET faster?

I have a application web in C#.NET, I put multiple GridViews and i think that it`s the reason that my applicaciont is so slow, My question is...

is there anyway to make my application faster without removing Grids?
2 Solutions
Remove view states on server controls

Enable connection pooling

Use Caching

And many more, Here is one from MS (I cant recall all :) )


It's hard to say without knowing details but... I believe grid views themselves are not a big problem. Reckon you need to fill them with data... And this data comes from a database. And here I guess is the problem - might be too complex queries or not optimized database. Also, if you use dataAdapters etc it works pretty slow. You may need to consider using datareaders etc. See:

SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
Hi, it is possible. How to retrieve all the data into gridview in your application. It is require to use stored procedures and if you want to display data only then use the datareader, not dataset or datalist.
Independent Software Vendors: 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!

I would start with anarki's suggesting of looking at the database query time first.  Even simple fixes like adding ndexes can improve performance by several orders of magnitude.  Execute your queries by them selves (Query analyzer or SSMS if this is sql server to see how long your queries take).

I would also look at the size of the data being returned.  A large data set over a slow network (from the db server to the web server OR from the web server to the client) is another obvious bottle neck.  If you have no choice but to return a large dataset to the client, it may be a good idea to follow radcaesar's suggestion of disabling viewstate on the grid or other large databound controls (drop down lists for example).  However, doing this in general is overkill.  If the http response to the client is really that large, enable http compression on your web server instead.  To analyze the http response, try Fiddler: www.fiddler2.com.

Caching is also a good suggestion, but is only effective on subsequent hits, so if the data or query is changing it won't do you much good.  You can read about caching here: http://msdn.microsoft.com/en-us/library/xsbfdd8c.aspx

Datareaders are faster in terms of raw speed.  However, there are a number of reasons why you might NOT want to use them over datasets:
1.) The improvement can be modest relative to the entire execution.
2.) Datareader's speed is at the cost of database concurrency.  If you are not closing your readers very quickly, they can create scalability problems as user loads increases.
3.) While datasets aren't a great return type for a middle teir, they're better than a datareader.  Passing a datareader out of a method and expecting the caller to close it is not a very good design.

Contrary to popular belief, there is NO performance gain from using stored procedures over inline code (at least not in sql server).  This is not to say using stored procs is a bad idea, but the only thing they'll save you is a couple of bytes in backend network traffic.

what datagrid dispaly and is it used paging.
use fiddler or YSlow addin for Fire Fox to determine where the bottle neck is. Once you know what is slow or what the application is doing begtween the client and the server you can widdle down the time.


Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now