how to make my application .NET faster?

Posted on 2011-04-25
Last Modified: 2013-12-16
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?
Question by:tenriquez199
    LVL 9

    Expert Comment

    Remove view states on server controls

    Enable connection pooling

    Use Caching

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

    LVL 29

    Accepted Solution

    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:
    LVL 11

    Expert Comment

    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.
    LVL 11

    Assisted Solution

    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:

    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:

    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.

    LVL 9

    Expert Comment

    what datagrid dispaly and is it used paging.
    LVL 2

    Expert Comment

    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

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now