Groups | Blog | Home
all groups > asp.net building controls > april 2005 >

asp.net building controls : How to a avoid a *huge* viewstate?


mortb
4/22/2005 12:00:00 AM
I'm writing a custom treeview control.
The treeview is a htmltable with the nodes and branches,
The htmltable is located in a div to make it scrollable when it is larger
than a certain pixel size.
All this is nested in my custom control.
My problem is that the viewstate becomes really large when I add the control
to a test page which does not have any other controls on it.
I've tried to disable the viewstate both on the page, the control and the
htmltable, but nothing seems to work!
The 30kb viewstate is still there.
I have no need to store the contents of the treeview in the viewstate as
this is updated from the database every pageload.

Please help!
mortb

mortb
4/26/2005 12:00:00 AM
What I needed was the viewstate decoder!

http://www.pluralsight.com/tools.aspx

What a relief I felt when I found this. I saw that the problem was stemming
from my checkboxes so I wrot my own chekbox control and now my view state is
less than a kb!

cheers,
mortb


[quoted text, click to view]

Ken Cox [Microsoft MVP]
5/1/2005 12:00:00 AM
If you don't need viewstate for controls, just turn it off to cut the
traffic substantially.

[quoted text, click to view]

AddThis Social Bookmark Button