Completly Removing ViewState WebFroms

Here is the code to completely remove view state from the page:
#region ViewState

protected override void SavePageStateToPersistenceMedium(object viewState)
{
}

protected override object LoadPageStateFromPersistenceMedium()
{
return null;
}

#endregion
Make sure that none of the controls in the page rely on ViewState to function properly. {6230289B-5BEE-409e-932A-2F01FA407A92}

Comments

  1. Does the EnableViewState="False" switch do something similar?

    ReplyDelete
  2. EnableViewState="False" will not remove everything. There is still some unneeded internals writtent to the View State. However, setting EnableViewState="False" is the first step in getting everything cleaned up.

    ReplyDelete
  3. How to remove gridview viewstate except 1 label inside the grid view?

    ReplyDelete
  4. I get this Error-Message:
    Compilerfehlermeldung: CS0115: "App_Template_MasterPage.SavePageStateToPersistenceMedium(object)": Es wurde keine passende Methode zum √úberschreiben gefunden.

    ReplyDelete

Post a Comment

Popular posts from this blog

Yet once more into the breech (of altered programming logic)

Simple WP7 Mango App for Background Tasks, Toast, and Tiles: Code Explanation

How to convert SVG data to a Png Image file Using InkScape