J
Juan T. Llibre
re:
!> What controls specifically (other than gridview, which I am not using)
!> could cause viewstate to grow?
All/any of them, as I explained in my last reply to this thread.
I also posted specifics to help you get rid of ViewState in any control.
Give that a try, will you ?
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/
=====================================================
!> What controls specifically (other than gridview, which I am not using)
!> could cause viewstate to grow?
All/any of them, as I explained in my last reply to this thread.
I also posted specifics to help you get rid of ViewState in any control.
Give that a try, will you ?
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 said:I understand how viewstate works. That is not my question.
**I already have <pages enableViewState="false"> in my web.config.**
What controls specifically (other than gridview, which I am not using) could
cause viewstate to grow?
Allen Chen said:Hi,
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?
Thanks for your update. Almost all of the built-in ASP.NET controls uses
ViewState and some of the built-in controls such as GridView also use
ControlState. For example, the Label controls only uses ViewState to
persist data for the Text property:
public virtual string Text
{
get
{
object obj2 = this.ViewState["Text"];
if (obj2 != null)
{
return (string) obj2;
}
return string.Empty;
}
set
{
if (this.HasControls())
{
this.Controls.Clear();
}
this.ViewState["Text"] = value;
}
}
You can see ViewState is used. In addition, Label control overrides the
LoadViewState() method:
protected override void LoadViewState(object savedState)
{
if (savedState != null)
{
base.LoadViewState(savedState);
string str = (string) this.ViewState["Text"];
if (str != null)
{
this.Text = str;
}
}
}
On postback, the Text property will be reassigned so if you change Text
property on a button click event handler, the changed string will persist
for all subsequent postbacks.
If you have additional questions please feel free to ask.
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:
(e-mail address removed).