Ajax and viewstate

Last post 05-10-2008 11:15 PM by c0rrupt. 3 replies.

Sort Posts:

  • Ajax and viewstate

    05-08-2008, 4:23 PM
    • Loading...
    • c0rrupt
    • Joined on 06-13-2006, 3:07 PM
    • Posts 153

    When I first load a page, I set a default value to the viewstate. Later, i changed that value with an asyncpost back. Then when I do another asyncpostback, the viewstate is the same value from when I set it in the pageload.

    I am guessing that this is caused by the first asyncpostback just simply sending a call to the server, and not updating the viewstate on the page. How would I update the viewstate on the page from an asyncpostback?

  • Re: Ajax and viewstate

    05-08-2008, 11:26 PM
  • Re: Ajax and viewstate

    05-09-2008, 3:14 PM
    • Loading...
    • vgiambattista
    • Joined on 01-13-2006, 2:40 PM
    • Atlanta, GA
    • Posts 91

    c0rrupt,

    It's an old technique, but you could always just use a HiddenField control to make sure your data element is always available through the async postback.

    James

    James Ashley, Magenic Technologies
    (james.ashley.magenic@gmail.com)
  • Re: Ajax and viewstate

    05-10-2008, 11:15 PM
    • Loading...
    • c0rrupt
    • Joined on 06-13-2006, 3:07 PM
    • Posts 153

    ya, thats what I winded up doing.

Page 1 of 1 (4 items)