Cool Code - VB.Net - Property Setup to a View State Variable

Public Property TabSelect() As Integer

    Get

        Dim tmp As Object = ViewState(“local_TabSelect”)
        If Not tmp Is Nothing Then

            Return Convert.ToInt32(tmp)
        Else

            Return 1
        End If

    End Get

    Set(ByVal Value As Integer)
        ViewState(“local_TabSelect”) = Value
    End Set

End Property

Leave a Reply