ViewState not working on users pc RRS feed

  • Question

  • User1145344921 posted

    I'm having an issue with ViewState working on a user's pc.  Does anyone know any issue that would could ViewState not wto work on a pc?

    The viewstate value is populated from the database after postback.

    Could it be an IE version issue?  Everything is working fine on my PC which is using IE7. 

    I'm using the following ViewState property below:

    Public Property CustomDate() As Boolean
                If ViewState("MultipleDate") Is Nothing Then
                    Return False
                    Return ViewState("MultipleDate")
                End If
            End Get
            Set(ByVal Value As Boolean)
                ViewState("MultipleDate") = Value
            End Set
        End Property
    Friday, November 25, 2011 1:16 PM

All replies

  • User-744022866 posted

    Viewstate behaviour is not depends on the client browser, so what ever the browser it should work.

    can you specify the error, double check your application logic....

    Friday, November 25, 2011 2:26 PM
  • User1145344921 posted

    When the page loads, a function is called to populate all of the fields on the page with values from the database.  I have a line of code that sets the value of the property inside of the function depending on what value is contained in a dataset.

    If drDates("date_id") = "3" Then
       Me.CustomDate = True
    End if

    The code above should set the boolean value to True. The next time the user clicks the save button, this value is checked to determine if an insert or update is required.  If the value is equal to True, an update should be performed.  This process works on my pc but is always set to false on another user's pc.  As a result, inserts are always performed.

    Friday, November 25, 2011 3:02 PM
  • User-158764254 posted

    Perhaps that other user has adjusted their local browsers page cache settings and so they are posting an old copy of the page from their cache? 

    Have them completely clear their local browsers cache and try it again to see if this might be the case.

    Friday, November 25, 2011 5:29 PM
  • User1145344921 posted

    I've cleared the cache but I'm still experiencing the same issue.  IE settings are set to automatically check for newer versions of a web page. Is there anything else I should check?

    Monday, November 28, 2011 10:05 AM
  • User1145344921 posted

    The user has forms checked for an autocomplete option in IE 7.  Could this cause problems with viewstate?

    Monday, November 28, 2011 11:54 AM
  • User2115259052 posted

    I have not faced Viewstate related issues in any version of IE.

    Have to changed the location of Viewstate to store it in some other location (Session?) instead of the page (default) by implementing SessionStatePersister?

    Monday, November 28, 2011 12:09 PM
  • User-578657687 posted

    Hi VBJunkie,

    ViewState's execution doesn't reply on client browser. I have checked your source code, it's ok. Maybe the reason why ViewState doesn't wokr is that you have disabled the ViewState:

    View state is enabled by default, but some controls on a page might not need view state. For example, if a control is refreshed from the data store on each postback, you can turn view state off for that control in order to reduce the size of view state.

    You can configure controls so that view state is disabled by default for all controls within a page or a container control, and you can then enable view state for specific controls. You can also configure controls so that view state is disabled and cannot be enabled for child controls.

    To disable view state for a control by default so that it can be enabled for child controls, set the ViewStateMode property of the control to Disabled. To disable view state by default for an entire page, set the ViewStateMode attribute of the @ Page directive to Disabled.

    To disable view state for a control and its children so that it cannot be enabled for child controls, set the EnableViewState property of the control to false. To disable view state for an entire page and all of its child controls, set the EnableViewState attribute of the @ Page directive to false.

    Friday, December 2, 2011 12:47 AM