Re: Disable Viewstate

Tech-Archive recommends: Fix windows errors by optimizing your registry



Maybe it would be easier if you would post which controls you're using.

In any case, you can disable ViewState for any control
by setting its EnableViewState property to false :

<asp:TextBox id="SomeName" runat="server" EnableViewState="false" />

Set EnableViewState="false" for all other controls on the page,
like dropdowns, buttons, etc.




Juan T. Llibre, asp.net MVP
¿ Estas probando VS 2010 y ASP.NET 4.0 ?
Regístrate (gratis) en los Foros de VS 2010 y ASP.NET 4.0, en español
http://asp.net.do/foros/forums/
=====================================================
"MCM" <MCM@xxxxxxxxxxxxxxxx> wrote in message news:82A0CD9D-D5BA-4886-ABAA-33D140677D57@xxxxxxxxxxxxxxxx
I already have <pages enableViewState="false"> in my web.config. And none of
the controls have a gridview. What other things use viewstate/controlstate
other than gridview?


"Allen Chen [MSFT]" wrote:

Hi,

Then I can reuse the control several times on the same page. What exactly
would Viewstate be doing that it is required for this control?

Thanks for your reply. In this case, since you've specified the Text on
every postback. ViewState is not needed. You can disable them by setting

<pages enableViewState="false">

in web.config.

You can see the size of ViewState hidden field gets decreased. If you want
to know what's exactly stored in ViewState, you can use this tool:

http://www.pluralsight.com/community/media/p/51688.aspx

If your usercontrol contains some built-in controls that uses control state
to store data (for example, GridView), your page may have some data stored
in ViewState that cannot be eliminated by the <pages
enableViewState="false"> setting.

Please let me know if you have additional questions. I'll do my best to
follow up.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx





.


Quantcast