What can i store in viewstate using "ViewState(key) = value" & "Value = ViewState(key)"

Last post 05-19-2007 10:51 PM by dbland07666. 2 replies.

Sort Posts:

  • What can i store in viewstate using "ViewState(key) = value" & "Value = ViewState(key)"

    05-19-2007, 12:03 PM
    • Member
      3 point Member
    • costrak
    • Member since 05-12-2007, 10:13 PM
    • Posts 32

    Hi All

     

    I am struggling to maintain user information accross a sequence of 4 pages

    now i'm trying to save data in viewstate till they can be transmitted to the next page

     

    This code

     ViewState(vPropertyRentalContactName) = "aa"

     

    is not working

     

  • Re: What can i store in viewstate using "ViewState(key) = value" & "Value = ViewState(key)"

    05-19-2007, 12:17 PM
    Answer
    • All-Star
      123,550 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,664
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    if you want to persist something across pages on a per user basis I would probably use the Session object instead. Please take a look at this article ASP.NET: Nine Options for Managing Persistent User State in Your ASP.NET Application to get a better view of what's possible.

    Grz, Kris.

  • Re: What can i store in viewstate using "ViewState(key) = value" & "Value = ViewState(key)"

    05-19-2007, 10:51 PM
    • Contributor
      4,118 point Contributor
    • dbland07666
    • Member since 05-15-2007, 10:02 AM
    • Wall Street
    • Posts 697

    When you say it's not working, do you mean that you set viewstate and go to a different page and lose the viewstate?  Viewstate only works on the same page, to go from page to page use Session.  Note that when you use session you have to take special precautions on a server farm or web garden (a web garden is a multi-cpu machine) since session does not automatically persist across machines.

    - David

    Please click "Mark as Answer" on all posts that help you.
Page 1 of 1 (3 items)