Re: textbox's state does not persist if onTextChanged not defined
From: Craig Deelsnyder (cdeelsny_at_no_spam_4_meyahoo.com)
Date: 08/06/04
- Next message: Alvin Bruney [MVP]: "Re: Safe multithreading in ASP.Net"
- Previous message: who be dat?: "Safe multithreading in ASP.Net"
- In reply to: Henri: "Re: textbox's state does not persist if onTextChanged not defined"
- Next in thread: Henri: "Re: textbox's state does not persist if onTextChanged not defined"
- Reply: Henri: "Re: textbox's state does not persist if onTextChanged not defined"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 05 Aug 2004 22:50:38 -0500
On Fri, 6 Aug 2004 03:18:44 +0200, Henri <hmfireball@hotmail.com> wrote:
> Thanks for your help Fred,
> but it seems that this behavior is by design.
> Even with ViewState enabled, input fields' Value is never stored in it
> unless you want to know when Value changed (by defining the OnTextChanged
> attribute).
> Seems that I'll have to customize TextBox!
>
This is because ViewState only stores what .NET cannot get from the
request stream. When a form is submitted, the textboxes and other
controls attach their name,value pairs onto the request stream, so that is
where .NET reads the 'new values' for all controls from. .NET knows this
data will be there, so it doesn't duplicate it into ViewState (especially
since ViewState would not have the correct value, it's not modified on the
client, it's static content itself, so it doesn't 'know' what the user has
just entered or modified on the screen)
Think of ViewState as having anything that isn't normally in a form POST
request, such as the text value of labels, e.g.
BTW, EnableViewState is true on controls by default, which is why you
don't have to include it as an attribute on a control. When you view a
control's properties in the Properties Window, only those that are
modified from their default values (they'd then turn bold in that window)
are added as attributes in the .aspx by VS.NET. You can of course
manually add them in as well...
-- Craig Deelsnyder Microsoft MVP - ASP/ASP.NET
- Next message: Alvin Bruney [MVP]: "Re: Safe multithreading in ASP.Net"
- Previous message: who be dat?: "Safe multithreading in ASP.Net"
- In reply to: Henri: "Re: textbox's state does not persist if onTextChanged not defined"
- Next in thread: Henri: "Re: textbox's state does not persist if onTextChanged not defined"
- Reply: Henri: "Re: textbox's state does not persist if onTextChanged not defined"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|