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

  • Thread starter Thread starter reju
  • Start date Start date
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
 
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/
 
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
 
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/
===================================
 
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
 
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
 
You have to weigh the pros and cons of disabling Viewstate
and determine whether disabling it is a good policy for you.




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/
===================================
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
 
Back
Top