views:

613

answers:

3

Any practical tips/tricks on how to do that?

It doesn't seem that there is a lot of information about how to do that. I am loading data from the database into TreeView and the max number of nodes will be around 100. I am still interested in minimizing the ViewState.

I will also be adding and deleting nodes dynamically (though the user interaction).

Thanks!

PS: I am using asp.net 2.0, c#, webforms (so don't give me tips that relate to to ASP MVC only)

+1  A: 

Well you could just stored ViewState in Session and prevent it from going down to the Client at all. Then it'll just be controlstate that's sent up and down which should reduce the page size pretty dramatically...

protected override PageStatePersister PageStatePersister
{
    get
    {
        return new SessionPageStatePersister(this);
    }
}

More info @ this question

http://stackoverflow.com/questions/386131/keeping-viewstate-in-sessionpagestatepersister

Eoin Campbell
+2  A: 

here is a wonderful way to just get rid of viewstate from being sent over wire for each post-back. basically, it stores the complete viewstate as a session variable on the server and only transfers the identifier in the viewstate field.

compression will save you little bit in terms of bandwidth whereas putting getting viewstate out of the page will have quite dramatic performance improvement

the following articles explains several techniques with performance measurement metrics as well eggheadcafe

Vikram
I like that.. +1
madcolor