Viewstate Question

Posts   
 
    
pd
User
Posts: 3
Joined: 29-Nov-2006
# Posted on: 29-Nov-2006 23:20:18   

Hi All,

I've been experimenting with LLBLGenProDataSource control and databinding and have a question about viewstate size.

I have the Nov 6 release of LLBLGenPro 2.0

My table has a total of 4 rows. The mapped entity has 2 integer, 1 string & 1 boolean properties.

If I bind a collection of these entities to a gridview control using the LLBLGenDatasource the viewstate size for the LLBLGenDatasource is 7760 bytes.

Because I want to apply a filter to the collection I use the Perform_Select event, disable livepersistance and retrieve the filtered data (2 entities returned instead of 4). The viewstate size for the LLBLGenDatasource is now 29240 bytes....

Am I doing something wrong? Why such a huge increase?

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 30-Nov-2006 09:22:38   

The viewstate size depends on the number of controls that use it.

To test for the LLBLGenProDataSource, you may create an empty web page with just a one LLBLGenProDataSource and the datagrid to display the data. And then try to replicate your scenario.

Also I think having a ViewState with 10-30 Kb is acceptable, otherwise if you want more light weight, then you might use DataTables(TypedLists, TypedViews & DynamicLists), instead of EntityCollections.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 30-Nov-2006 09:47:22   

You can also set the datasourcecache to session instead of viewstate. That's normally more efficient, as it doesn't need to use serialization in that case.

Frans Bouma | Lead developer LLBLGen Pro
pd
User
Posts: 3
Joined: 29-Nov-2006
# Posted on: 30-Nov-2006 20:38:21   

Thanks guys. I've experimented with a typed list and the footprint is much smaller so for larger results I'll use those instead.

Cheers