Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > viewstate??

Reply
Thread Tools

viewstate??

 
 
Mikael Janers
Guest
Posts: n/a
 
      11-13-2003
Hello!

Does anyone have any information about how a
System.Web.UI.WebControls.TextBox keeps its value between posts ?
Everywhere I read it says it's the viewstate. But clearly it isn't because
if you override the controls viewstate functions and even disable viewstate
on the page the control still keep its value on a postback??

// Mikael


 
Reply With Quote
 
 
 
 
Ruslan
Guest
Posts: n/a
 
      11-13-2003
"Mikael Janers" <nospam> wrote in message news:<(E-Mail Removed)>...
> Hello!
>
> Does anyone have any information about how a
> System.Web.UI.WebControls.TextBox keeps its value between posts ?
> Everywhere I read it says it's the viewstate. But clearly it isn't because
> if you override the controls viewstate functions and even disable viewstate
> on the page the control still keep its value on a postback??
>
> // Mikael


If TextBox has Visible = False, it keeps it's value in the viewstate,
otherwise it loads the text from the postback data.

The execution flow is somewhat like this:

Page.ProcessRequestMain() -> Page.ProcessPostData() ->
IPostBackEventHandler(control).LoadPostData() ->
Control.LoadPostData()

The actual implementation for the TextBox is here:

private bool System.Web.UI.IPostBackDataHandler.LoadPostData(st ring
postDataKey, NameValueCollection postCollection)
{
if (!this.Text.Equals(postCollection[postDataKey]))
{
this.Text = postCollection[postDataKey];
return true;
}
return false;
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments