Viewstate size

I am using databound windows grid, latest asof 12/29/09 V(2.0.3.2000) DLL. I have noticed that regardless of the session mode = Session, there is still a large (500K plus) viewstate being sent to the client; I am trying to optimize the performance so I have tried switching session mode from viewState to Session, and that has helped a bit; I then tried setting "EnableViewState=“false” on my page, but then .GetRowBoundObject method in server side events seems to return null; so my code can;t tell what row/cell has been clicked, so that messes up my application logic. I then tried changing page size to reduce the amount of data sent to the client, and here I am puzzled. Even with a very small page size (8 rows) view state is HUGE, about over 300Ka LOT, and if I disable paging, the viewstate only increases by 50K or so (but my grid render time becomes unmanageable). So, it looks like your are sending then entire state of the bound object to the client in thew viewstate, not just 1 page worth of data. This causes a pretty significant delay over slow connections, making bound mode to be very slow as well as server memory intensive.

So, the question is what should/could I do to improve performance? I pretty much know I have to use paged mode to avoid slow HTML table rendering (30+ seconds for 1000 rows on C2D 2Ghz CU under IE7), but now I am also trying to avoid massive amount of data sent between the client browser and a server. Can page view state be turned off to avoid this? If so,t why are my events then unable to get the correct bound object data?

Hi,

Well, I am using cache file to save memory. It will enhance the performance to certain extent. And, the ViewState will be decreased too.


Thank you.

is it something that will be done in the future release or is it there now? If it is there now, is there anything special that I need to do?

Thanks

Hi,

We will get back to you soon.

Thank you.

Hi,

We have logged your feature request (enhancement for viewstate size) into issue tracking system with an issue id: CELLSNET-13800. We will keep you updated when there is any update about it.

Thank you.

Hi,

Well, if GridWeb is working on databind mode, the datasource
will be stored into viewstate by the .NET Framework. So, the viewstate would be large. We
cannot enhance it in GridWeb directly.

The .Net Framework 2.0 provides PageStatePersister class to store the viewstate into session. We use it to decrease the size of viewstate.


Could you try accordingly if it works for you:


1) Add these lines into your page code:

PageStatePersister _pageStatePersister;

protected override PageStatePersister PageStatePersister

{

get

{

if (_pageStatePersister == null)

_pageStatePersister = new SessionPageStatePersister(this);

return _pageStatePersister;

}

}

2) Add these lines into <system.web> element in your web.config:

<browserCaps>

<case>RequiresControlStateInSession=true</case>

</browserCaps>



Thank you.