viewstate??

Discussion in 'ASP .Net Web Controls' started by Mikael Janers, Nov 13, 2003.

  1. 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
    Mikael Janers, Nov 13, 2003
    #1
    1. Advertising

  2. Mikael Janers

    Ruslan Guest

    "Mikael Janers" <nospam> wrote in message news:<>...
    > 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(string
    postDataKey, NameValueCollection postCollection)
    {
    if (!this.Text.Equals(postCollection[postDataKey]))
    {
    this.Text = postCollection[postDataKey];
    return true;
    }
    return false;
    }
    Ruslan, Nov 13, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Rush
    Replies:
    2
    Views:
    518
    Ben Rush
    Dec 5, 2003
  2. Steph
    Replies:
    2
    Views:
    1,659
    heislord5
    May 11, 2011
  3. ujjc001
    Replies:
    0
    Views:
    1,369
    ujjc001
    Jul 27, 2005
  4. sck10
    Replies:
    6
    Views:
    909
    sck10
    Sep 1, 2006
  5. mark

    Viewstate errors... how do I get viewstate working?

    mark, Feb 20, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    275
Loading...

Share This Page