Disabling ViewState Throughout

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to disable ViewState for all pages associated with a given MasterPage.
How do I do this? I've tried doing...

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="StdMaster.master.cs"
EnableViewState="false"
Inherits="StdMaster" %>

but I still see ViewState hidden tages in my pages
 
Even if you set it to false, a viewstate control will be added if your page
has a server side form (ie, <form runat="server">). To be honnest, I'm not
sure why that is and what information is added to the viewstate, i just know
it's true :)

The page's SavePageStateToPersistenceMedium and
LoadPageStateFromPersistenceMedium methods might be the only way you have to
completely eliminate the viewstate...

Karl
 
Karl said:
Even if you set it to false, a viewstate control will be added if your
page has a server side form (ie, <form runat="server">). To be honnest,
I'm not sure why that is and what information is added to the viewstate,
i just know it's true :)

The page's SavePageStateToPersistenceMedium and
LoadPageStateFromPersistenceMedium methods might be the only way you
have to completely eliminate the viewstate...

Karl

The only way I know is to use a httphandler and remove it from the
output, easy to do if your rendering xhtml. This is one of those
annoying .net things that would be easy to change if we could change the
framework source code and compile it as needed.
 
Back
Top