468,139 Members | 1,410 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,139 developers. It's quick & easy.

disable ViewState ?

on my page I have
<%@ Page Language="C#" EnableViewState="false"%>

But in HTML i still see __VIEWSTATE hidden variable.

<form name="form1" method="post" action="......" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMTQ4MzQwNDAwZGQTxfqLHt6P7WAXU/Mbh/hWT54/7Q==" />
</div>

why is that and how can i disbale ViewState completelly?

I am using NET 2.0

thanks

George
Oct 17 '06 #1
7 1913
something you can do is to look at the trace output for that page by
enabling tracing in the web.config. The trace output will show the size in
bytes for each control's viewstate. There could be a control in the page
that doesn't inherit it's settings from the page itself that you can then
try turning off the viewstate for that control.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"George Ter-Saakov" <gt****@cardone.comwrote in message
news:eE**************@TK2MSFTNGP05.phx.gbl...
on my page I have
<%@ Page Language="C#" EnableViewState="false"%>

But in HTML i still see __VIEWSTATE hidden variable.

<form name="form1" method="post" action="......" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMTQ4MzQwNDAwZGQTxfqLHt6P7WAXU/Mbh/hWT54/7Q==" />
</div>

why is that and how can i disbale ViewState completelly?

I am using NET 2.0

thanks

George


Oct 17 '06 #2
It will be always there. Do you think an extra Kbyte will affect your page
performance? You will find yourself in a lot of scenarios where you do want
ViewState.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:eE**************@TK2MSFTNGP05.phx.gbl...
on my page I have
<%@ Page Language="C#" EnableViewState="false"%>

But in HTML i still see __VIEWSTATE hidden variable.

<form name="form1" method="post" action="......" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMTQ4MzQwNDAwZGQTxfqLHt6P7WAXU/Mbh/hWT54/7Q==" />
</div>

why is that and how can i disbale ViewState completelly?

I am using NET 2.0

thanks

George


Oct 17 '06 #3
It's generated by/for the <form runat="server" ... >

the only way to remove it is to take out the form tag, which won't work for
most aspx pages.

trace=true is a great idea, incase I'm wrong :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:es**************@TK2MSFTNGP02.phx.gbl...
It will be always there. Do you think an extra Kbyte will affect your page
performance? You will find yourself in a lot of scenarios where you do
want ViewState.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:eE**************@TK2MSFTNGP05.phx.gbl...
>on my page I have
<%@ Page Language="C#" EnableViewState="false"%>

But in HTML i still see __VIEWSTATE hidden variable.

<form name="form1" method="post" action="......" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMTQ4MzQwNDAwZGQTxfqLHt6P7WAXU/Mbh/hWT54/7Q==" />
</div>

why is that and how can i disbale ViewState completelly?

I am using NET 2.0

thanks

George



Oct 17 '06 #4
Thanks everyone for a suggestions.
Not like extra 10 bytes going to make a difference but I just like my staff
to be clean and if I said that I do not want a Viewstate I mean it and want
..NET 2.0 to respect it :)
George.
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netwrote in message news:ua**************@TK2MSFTNGP03.phx.gbl...
It's generated by/for the <form runat="server" ... >

the only way to remove it is to take out the form tag, which won't work
for most aspx pages.

trace=true is a great idea, incase I'm wrong :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:es**************@TK2MSFTNGP02.phx.gbl...
>It will be always there. Do you think an extra Kbyte will affect your
page performance? You will find yourself in a lot of scenarios where you
do want ViewState.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:eE**************@TK2MSFTNGP05.phx.gbl...
>>on my page I have
<%@ Page Language="C#" EnableViewState="false"%>

But in HTML i still see __VIEWSTATE hidden variable.

<form name="form1" method="post" action="......" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMTQ4MzQwNDAwZGQTxfqLHt6P7WAXU/Mbh/hWT54/7Q==" />
</div>

why is that and how can i disbale ViewState completelly?

I am using NET 2.0

thanks

George




Oct 17 '06 #5
You will save a lot of time and nerves if you will respect asp.net too.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:uK**************@TK2MSFTNGP03.phx.gbl...
Thanks everyone for a suggestions.
Not like extra 10 bytes going to make a difference but I just like my
staff to be clean and if I said that I do not want a Viewstate I mean it
and want .NET 2.0 to respect it :)
George.
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netwrote in message news:ua**************@TK2MSFTNGP03.phx.gbl...
>It's generated by/for the <form runat="server" ... >

the only way to remove it is to take out the form tag, which won't work
for most aspx pages.

trace=true is a great idea, incase I'm wrong :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:es**************@TK2MSFTNGP02.phx.gbl...
>>It will be always there. Do you think an extra Kbyte will affect your
page performance? You will find yourself in a lot of scenarios where you
do want ViewState.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:eE**************@TK2MSFTNGP05.phx.gbl...
on my page I have
<%@ Page Language="C#" EnableViewState="false"%>

But in HTML i still see __VIEWSTATE hidden variable.

<form name="form1" method="post" action="......" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMTQ4MzQwNDAwZGQTxfqLHt6P7WAXU/Mbh/hWT54/7Q==" />
</div>

why is that and how can i disbale ViewState completelly?

I am using NET 2.0

thanks

George




Oct 17 '06 #6
So, what this do:

<%@ Page EnableViewState="false" %>

If it doesn't get rid of the 10 pages of ViewState text on my web form,
what's the point? This page displays a DataGrid and I don't see any reason
to want ViewState -- especially since it's transferring thousands of bytes of
text.
Thanks
/Ken
"Eliyahu Goldin" wrote:
It will be always there. Do you think an extra Kbyte will affect your page
performance? You will find yourself in a lot of scenarios where you do want
ViewState.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
Jan 19 '07 #7
If you disable viewstate, you won't have the 10 pages. You will still have
the __VIEWSTATE hidden variable but it will be much smaller. And you can
always disable viewstate for controls individually.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"ken s" <ke**@discussions.microsoft.comwrote in message
news:25**********************************@microsof t.com...
So, what this do:

<%@ Page EnableViewState="false" %>

If it doesn't get rid of the 10 pages of ViewState text on my web form,
what's the point? This page displays a DataGrid and I don't see any
reason
to want ViewState -- especially since it's transferring thousands of bytes
of
text.
Thanks
/Ken
"Eliyahu Goldin" wrote:
It will be always there. Do you think an extra Kbyte will affect your
page
performance? You will find yourself in a lot of scenarios where you do
want
ViewState.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Jan 20 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Homa | last post: by
1 post views Thread by Rhodri | last post: by
3 posts views Thread by Stan | last post: by
7 posts views Thread by Jo Inferis | last post: by
6 posts views Thread by sri_san | last post: by
6 posts views Thread by =?Utf-8?B?Unlhbg==?= | last post: by
4 posts views Thread by =?Utf-8?B?TUNN?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.