textbox ignores disabled viewstate?

Discussion in 'ASP .Net' started by PJ6, Dec 2, 2005.

  1. PJ6

    PJ6 Guest

    I have a textbox control where OnKeyPress of Enter, a few hidden field
    values are set and then form[0] is submitted from JavaScript. The page
    reloads, and this textbox is then repopulated with data that may be
    different than what the user just entered. Well, I'm having a problem with
    this textbox getting its value set after the page Load event to the text the
    user just entered - even when I've explicitly disabled ViewState! I found a
    way around this by changing the ID of the TextBox every time the page loads
    using a GUID... but is this really necessary? I must have missed something -
    there must be a way of preventing the browser from blithely ignoring my
    request not to record viewstate, right?

    Paul
    PJ6, Dec 2, 2005
    #1
    1. Advertising

  2. The textbox doesn't use ViewState to store its value. Instead its a simple
    post in for Form collection.
    Try setting the text property to a value of your choice in the Render event.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "PJ6" <> wrote in message
    news:...
    >I have a textbox control where OnKeyPress of Enter, a few hidden field
    >values are set and then form[0] is submitted from JavaScript. The page
    >reloads, and this textbox is then repopulated with data that may be
    >different than what the user just entered. Well, I'm having a problem with
    >this textbox getting its value set after the page Load event to the text
    >the user just entered - even when I've explicitly disabled ViewState! I
    >found a way around this by changing the ID of the TextBox every time the
    >page loads using a GUID... but is this really necessary? I must have missed
    >something - there must be a way of preventing the browser from blithely
    >ignoring my request not to record viewstate, right?
    >
    > Paul
    >
    Steve C. Orr [MVP, MCSD], Dec 2, 2005
    #2
    1. Advertising

  3. PJ6

    PJ6 Guest

    I had set AutoPostBack = False, too. Guess that doesn't matter though.

    I think I'll override the Text property and just prevent it from being set.
    I'll just have to remember not to try to set it the normal way in my own
    code.

    Thanks,
    Paul

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:...
    > The textbox doesn't use ViewState to store its value. Instead its a
    > simple post in for Form collection.
    > Try setting the text property to a value of your choice in the Render
    > event.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "PJ6" <> wrote in message
    > news:...
    >>I have a textbox control where OnKeyPress of Enter, a few hidden field
    >>values are set and then form[0] is submitted from JavaScript. The page
    >>reloads, and this textbox is then repopulated with data that may be
    >>different than what the user just entered. Well, I'm having a problem with
    >>this textbox getting its value set after the page Load event to the text
    >>the user just entered - even when I've explicitly disabled ViewState! I
    >>found a way around this by changing the ID of the TextBox every time the
    >>page loads using a GUID... but is this really necessary? I must have
    >>missed something - there must be a way of preventing the browser from
    >>blithely ignoring my request not to record viewstate, right?
    >>
    >> Paul
    >>

    >
    >
    PJ6, Dec 2, 2005
    #3
    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. Ken Varn
    Replies:
    4
    Views:
    459
    Ken Varn
    Nov 9, 2004
  2. Alejandro Penate-Diaz

    if (control.visible == false) viewstate disabled?

    Alejandro Penate-Diaz, Mar 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,460
    Alejandro Penate-Diaz
    Mar 4, 2005
  3. Tommy Martin

    Viewstate and disabled checkboxlist control

    Tommy Martin, Aug 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    433
    Tommy Martin
    Aug 12, 2005
  4. Ryan Liu
    Replies:
    1
    Views:
    798
    bruce barker
    Jul 13, 2009
  5. Melvyn

    DataGrid with ViewState disabled

    Melvyn, Nov 25, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    111
Loading...

Share This Page