disable ViewState ?

Discussion in 'ASP .Net' started by George Ter-Saakov, Oct 17, 2006.

  1. 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
     
    George Ter-Saakov, Oct 17, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Mark Fitzpatrick, Oct 17, 2006
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Eliyahu Goldin, Oct 17, 2006
    #3
  4. 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" <> wrote in
    message news:...
    > 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" <> wrote in message
    > news:...
    >> 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
    >>
    >>

    >
    >
     
    Karl Seguin [MVP], Oct 17, 2006
    #4
  5. 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:...
    > 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" <> wrote in
    > message news:...
    >> 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" <> wrote in message
    >> news:...
    >>> 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
    >>>
    >>>

    >>
    >>

    >
    >
     
    George Ter-Saakov, Oct 17, 2006
    #5
  6. 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" <> wrote in message
    news:...
    > 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:...
    >> 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" <> wrote in
    >> message news:...
    >>> 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" <> wrote in message
    >>> news:...
    >>>> 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
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Eliyahu Goldin, Oct 17, 2006
    #6
  7. 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]
    >
    >
    >
     
    =?Utf-8?B?a2VuIHM=?=, Jan 19, 2007
    #7
  8. 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" <> wrote in message
    news:...
    > 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]
    > >
    > >
    > >
     
    Eliyahu Goldin, Jan 20, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Homa
    Replies:
    2
    Views:
    1,919
  2. Rhodri
    Replies:
    1
    Views:
    383
    Rick Spiewak
    Apr 22, 2004
  3. Stan
    Replies:
    3
    Views:
    10,364
  4. Julien Grossiord

    Disable ViewState

    Julien Grossiord, Nov 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    7,831
    emancero
    Nov 12, 2006
  5. Umut Tezduyar
    Replies:
    4
    Views:
    3,338
    Ravi Ambros Wallau
    Feb 15, 2006
Loading...

Share This Page