I have some Page variables that I need to save across postbacks. I am wondering what are the pros and cons of using a page variable like:
Code:
Public sortDir As String
or a Page Property like:
Code:
' Holds the direction to be sorted...
Public Property sortDir() As String
Get
Return CStr(viewstate("sortDir"))
End Get
Set(ByVal Value As String)
ViewState("sortDir") = Value
End Set
End Property
The viewstate I know goes across the wire to the user as a hidden element on the page, and therefore affects page size, but are there other tradeoffs to consider? Then there's also the option of using a Session variable...
-------------------------
Beware of programmers with screwdrivers...