Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > disable ViewState ?

Reply
Thread Tools

disable ViewState ?

 
 
George Ter-Saakov
Guest
Posts: n/a
 
      10-17-2006
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


 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      10-17-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-17-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Karl Seguin [MVP]
Guest
Posts: n/a
 
      10-17-2006
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" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      10-17-2006
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
net> wrote in message news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-17-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
> net> wrote in message news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in
>> message news:(E-Mail Removed)...
>>> 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" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> 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
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
=?Utf-8?B?a2VuIHM=?=
Guest
Posts: n/a
 
      01-19-2007
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]
>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-20-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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]
> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable ViewState Julien Grossiord ASP .Net 2 11-12-2006 06:28 AM
Even I disable the ViewState property, I still see the hidden field _VIEWSTATE Umut Tezduyar ASP .Net 4 02-15-2006 08:35 PM
How can I completly disable ViewState? Stan ASP .Net 3 07-01-2004 12:17 PM
cannot disable viewstate on a datagrid Rhodri ASP .Net 1 04-22-2004 05:18 AM
Partially Disable DataList ViewState Homa ASP .Net 2 12-15-2003 08:40 PM



Advertisments