TextBox TextChanged Event

Discussion in 'ASP .Net Web Controls' started by sunilthk@gmail.com, Jun 25, 2006.

  1. Guest

    Hi All,
    I want to know how the TextBox control knows that it's data has been
    changed, since it is able to detect changes and fires TextChange event
    if the data in the TextBox has been changed. I know that TextBox class
    implements IPostBackDataHandler interface which defines a method
    LoadPostData(string postDataKey,NameValueCollection postCollection)
    the postCollection keeps the posted data for each web control. How
    ASP.NET fills this postCollection objects, i thought that ASP.NET uses
    view state to get posted values, but i set EnableViewState property of
    the text box=false then also the text changed event is firing.
    In other words in order to detect whether the TextBox's data has been
    changed
    you must know the old value and new value, so how ASP.NET knows the
    last posted value even if View State is disabled for the TextBox.
    Please let me know how this happens.
    Thanks
    Sunil
    , Jun 25, 2006
    #1
    1. Advertising

  2. hi Sunil,
    with viewstate disabled, the textbox does not know if the text has changed
    or not. It just fires the ontextchanged event regardless, whether the text
    changed or not. With viewstate enabled it compares old and new value and
    then fires the textchanged event only if the text has changed.
    Regards,
    Alessandro Zifiglio
    <> ha scritto nel messaggio
    news:...
    > Hi All,
    > I want to know how the TextBox control knows that it's data has been
    > changed, since it is able to detect changes and fires TextChange event
    > if the data in the TextBox has been changed. I know that TextBox class
    > implements IPostBackDataHandler interface which defines a method
    > LoadPostData(string postDataKey,NameValueCollection postCollection)
    > the postCollection keeps the posted data for each web control. How
    > ASP.NET fills this postCollection objects, i thought that ASP.NET uses
    > view state to get posted values, but i set EnableViewState property of
    > the text box=false then also the text changed event is firing.
    > In other words in order to detect whether the TextBox's data has been
    > changed
    > you must know the old value and new value, so how ASP.NET knows the
    > last posted value even if View State is disabled for the TextBox.
    > Please let me know how this happens.
    > Thanks
    > Sunil
    >
    Alessandro Zifiglio, Jun 25, 2006
    #2
    1. Advertising

  3. Guest

    Hi Alessandro,
    You are right, i've checked that (as you said) if view state is
    disabled TextChanged event fires if text is changed or not.
    Thanks alot for clearing my doubt. So it means ASP.NET uses ViewState
    to get posted values ?
    Thanks
    Sunil
    , Jun 26, 2006
    #3
  4. yes Sunil, asp.net stores the old value in viewstate, while getting the new
    value via http post through the form object collection.
    regards,
    Alessandro.
    <> ha scritto nel messaggio
    news:...
    >
    > Hi Alessandro,
    > You are right, i've checked that (as you said) if view state is
    > disabled TextChanged event fires if text is changed or not.
    > Thanks alot for clearing my doubt. So it means ASP.NET uses ViewState
    > to get posted values ?
    > Thanks
    > Sunil
    >
    Alessandro Zifiglio, Jun 26, 2006
    #4
    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.

Share This Page