This is some code behind for an aspx page. I'm not sure if I should be using public variables or a viewState
Partial Class madeUpName
Inherits System.Web.UI.Page
Public vin As String = ""
Public stk As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'inside of here i use the variables
end sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
'inside of here I also use the same variables
end sub
Should I use viewState variables or public variables in my class for the page? It seems like they both achieve the same thing.
Use ViewState
if you want the values to persist between postbacks.
If the values only need to exist for the lifetime of the page, regular variables will do just fine.