Speed up your page loads with a lighter ViewState

ASP.NET Team Blog
16 August 2007

Have you noticed your ASPX pages loading slower? Are you using grids? Many third party grids provide a lot of functionality in one control. However, if the control wasn't designed properly then you'll be paying the performance price. When using such grids, you'll notice your pages load slower and you may start to suspect the web server or database indexes. Or worse, the end-users will notice that the pages with some xyz grid are very slow.

You might be suffering from heavy ViewState, ASPxGridView can help rescue you from slow grid pages that suffer from heavy ViewState.

Heavy what?

What is ViewState? Basically, it's a method to persist state for controls between page requests. Click here for a detailed explanation.

ViewState on a diet

The ASPxGridView was designed to generate as little ViewState as is needed. Resulting in faster web pages for you. There are other solutions to remedy heavy ViewState on your pages but they all involve you having to manually code and/or configure each page. ASPxGridView is a drop-in solution.

Designed differently

The R&D team have implemented a smart state caching engine. This engine stores the difference between the control's initial and current state within the "callback state". This way the entire control hierarchy doesn't need to be recreated for every postback. With the new cache design, there's much less code downloaded to the client. That means every action, every callback, is much faster than other grids.

And it's not just in grids, our new smart caching is included in the ASPxperience Suite of controls.

Need proof?

Want to check the ViewState size for yourself? Here's a simple test you can perform on your pages to find the ViewState size. You can use the following JavaScript code from Dino's excellent article. Simply bind this method to any HTML Button control:

<script language="javascript">
    function ShowViewStateSize()
    {
        var buf = document.forms[0]["__VIEWSTATE"].value;
        alert("View state is " + buf.length + " bytes");
    }
</script>

For comparison, I've set up a small project with the ASPxGridView on one page and a standard MS GridView on another page. You can see the ViewState size for the GridView is 1856 bytes. Not bad, but the GridView doesn't do much besides paging and sorting.

MS GridView:

image

 

Now take a look at the ASPxGridView with the following powerful features enabled:

  • Grouping
  • Filtering
  • Exporting
  • Paging
  • Sorting

With all these features enabled, the ASPxGridView's ViewState is still smaller: 1428 bytes.

ASPxGridView:

image

 

Download ASPxGridView and try it out. And then be sure to let me know how much faster your pages load. I love hearing success stories :)

 

.

5 comment(s)
Teddy.Li
Teddy.Li

It's sure.

7 November, 2007
Anonymous
dave

good script. nice.

28 March, 2008
Anonymous
The ASPx Blog - Mehul Harry's DevExpress Blog

Check out this short article on how to use the row caching property of the ASPxGridView and an upcoming

22 September, 2009
Muchineripi Mamhinga 1
Muchineripi Mamhinga 1

Helpful

27 November, 2012
Ankit Jariwala
Ankit Jariwala

Hi, Mehul

I am using Temprory DataTable created using ViewState and appliying DataSource of AspxGridView.

InLine Add, Edit and Delete working in ViewState perfectly but When I am refreshing page or pressing "F5" ViewSatet lose data, whereas I am on the same page.

I set EnableCallBack false of GridView.

Please Help .

6 July, 2015

Please login or register to post comments.