I\'m trying to clean up an older ASP.NET WebForms site that has ViewState enabled everywhere. This is a performance issue - huge viewstates cause noticeable submit delays. B
As per the MSDN article on ViewStateMode, ViewStateMode
only has meaning when EnableViewState="true"
. To achieve what you want, you'll have to leave ViewStateMode="Enabled"
on the control, and then wrap the sub-controls of the main one in an asp:Placeholder
that has ViewStateMode="Disabled"
. That way, you can still manipulate ViewState in the codebehind, but no child control will have ViewState (except the ones you explicitly set to have it via ViewStateMode="Enabled"
).