is there any way to avoid __VIEWSTATE hidden field in the page

R

reju

Hi,

I am not using view state.I disabled the view state, but this hidden
__VIEWSTATE variable and some text is coming when we are taking the
view source.Is there any way to remove this variable?

Reju
 
G

Guest

Hi

You just cant get rid completely of the __VIEWSTATE field, it will always
contain a few bytes that are used internally and dont relate to your
control's state.

Adlai
-------------------------------------
If my answer helped you please press "Yes" bellow

×× ×ª×©×•×‘×” זו עזרה לך, ×× × ×”×¦×‘×¢ "כן"

Adlai Maschiach
http://blogs.microsoft.co.il/blogs/adlaim/
 
K

Kevin

Hi,

I am not using view state.I disabled the view state, but this hidden
__VIEWSTATE variable and some text is coming when we are taking the
view source.Is there any way to remove this variable?

Reju

You can override two page methods (available in ASP.NET 2.0) -
Page.LoadPageStateFromPersistenceMedium() and
Page.SavePageStateToPersistenceMedium(viewState) to store viewstate in
Session / Cache / SQL with the need to send it to the client (by
default). More info can be found here:

http://www.codeproject.com/aspnet/PersistentStatePage.asp
 
J

Juan T. Llibre

Set EnableViewState to false in the page directive or in the app's web.config.

Per page (in directive) : <%@ Page EnableViewState="False" ... %>
Per application (in web.config) : <Pages EnableViewState="false" ... />

You can also disable it for individual controls.

Doing that will reduce viewstate to a very small size.

If you want to disable it completely ( remove it ), see Natty Gur's sample code :

http://weblogs.asp.net/ngur/archive/2004/03/08/85876.aspx
 
R

reju

Set EnableViewState to false in the page directive or in the app's web.config.

Per page (in directive) : <%@ Page EnableViewState="False" ... %>
Per application (in web.config) : <Pages EnableViewState="false" ... />

You can also disable it for individual controls.

Doing that will reduce viewstate to a very small size.

If you want to disable it completely ( remove it ), see Natty Gur's sample code :

http://weblogs.asp.net/ngur/archive/2004/03/08/85876.aspx

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/

Hi Juan,
when I override the SavePageStateToPersistenceMedium method my submitt
buttons are not working,
I can't navigate to next page
Reju
 
R

reju

Set EnableViewState to false in the page directive or in the app's web.config.

Per page (in directive) : <%@ Page EnableViewState="False" ... %>
Per application (in web.config) : <Pages EnableViewState="false" ... />

You can also disable it for individual controls.

Doing that will reduce viewstate to a very small size.

If you want to disable it completely ( remove it ), see Natty Gur's sample code :

http://weblogs.asp.net/ngur/archive/2004/03/08/85876.aspx

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/

Hi Juan,
when I override the SavePageStateToPersistenceMedium method my submit
buttons are not working,
I can't navigate to next page
Reju
 
J

Juan T. Llibre

You have to weigh the pros and cons of disabling Viewstate
and determine whether disabling it is a good policy for you.





Set EnableViewState to false in the page directive or in the app's web.config.

Per page (in directive) : <%@ Page EnableViewState="False" ... %>
Per application (in web.config) : <Pages EnableViewState="false" ... />

You can also disable it for individual controls.

Doing that will reduce viewstate to a very small size.

If you want to disable it completely ( remove it ), see Natty Gur's sample code :

http://weblogs.asp.net/ngur/archive/2004/03/08/85876.aspx

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/

Hi Juan,
when I override the SavePageStateToPersistenceMedium method my submit
buttons are not working,
I can't navigate to next page
Reju
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top