本文整理汇总了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