viewstate on datagrid

D

Dave Bartlett

I've been wondering for a while if I can safely turn off viewstate on a
datagrid.

I read the following article:
http://msdn.microsoft.com/asp.net/u...pull=/library/en-us/dnaspp/html/viewstate.asp

but ended up more confused than before I read it.

We have a (fairly large) datagrid with editable cells - user edits cells
then submits changes.

Do I need viewstate enabled on the datagrid, basically doubling the HTML
size?

If not how do I deactivate it? (tried setting enableviewstate
property=false, but still see lots of viewstate stuff in HTML output)

Thanks
 
N

Natty Gur

hi,

1) the page will contain viewstate even if you wil set Page and all page
controlls viewstate to false. the viewstate will hold page hash key.
there fore this could be the data in view state that you see.

2) ViewState interduced by MS to reduce server side work when pastback
used. controls data that usually retrieved from DB preserved via hidden
field - ViewsState, therefore reducing number of access to DB. you can
remove ViewState from Grid but you need to take care of filling Grid
data.

3) you can use Page LoadPageStateFromPersistenceMedium and
SavePageStateToPersistenceMedium to compress viewstate data.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top