本文整理匯總了VB.NET中System.Web.UI.UserControl.SaveViewState方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET UserControl.SaveViewState方法的具體用法?VB.NET UserControl.SaveViewState怎麽用?VB.NET UserControl.SaveViewState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.UserControl
的用法示例。
在下文中一共展示了UserControl.SaveViewState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: LoadViewState
Public Property UserText() As String
Get
Return CStr(ViewState("usertext"))
End Get
Set(ByVal value As String)
ViewState("usertext") = value
End Set
End Property
Public Property PasswordText() As String
Get
Return CStr(ViewState("passwordtext"))
End Get
Set(ByVal value As String)
ViewState("passwordtext") = value
End Set
End Property
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub LoadViewState(ByVal savedState As Object)
Dim totalState As Object() = Nothing
If Not (savedState Is Nothing) Then
totalState = CType(savedState, Object())
If totalState.Length <> 3 Then
' Throw an appropriate exception.
End If
' Load base state.
MyBase.LoadViewState(totalState(0))
' Load extra information specific to this control.
If Not (totalState Is Nothing) AndAlso Not (totalState(1) Is Nothing) AndAlso Not (totalState(2) Is Nothing) Then
UserText = CStr(totalState(1))
PasswordText = CStr(totalState(2))
End If
End If
End Sub
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Function SaveViewState() As Object
Dim baseState As Object = MyBase.SaveViewState()
Dim totalState(2) As Object
totalState(0) = baseState
totalState(1) = user.Text
totalState(2) = password.Text
Return totalState
End Function
End Class