本文整理匯總了VB.NET中System.Web.UI.StateBag類的典型用法代碼示例。如果您正苦於以下問題:VB.NET StateBag類的具體用法?VB.NET StateBag怎麽用?VB.NET StateBag使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了StateBag類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Render
' This control renders values stored in view state for Text and FontSize properties.
Imports System.Web
Imports System.Web.UI
Namespace ViewStateControlSamples
Public Class CustomLabel : Inherits Control
Private Const defaultFontSize As Integer = 3
' Add property values to view state with set;
' retrieve them from view state with get.
Public Property [Text]() As String
Get
Dim o As Object = ViewState("Text")
If (IsNothing(o)) Then
Return String.Empty
Else
Return CStr(o)
End If
End Get
Set(ByVal value As String)
ViewState("Text") = value
End Set
End Property
Public Property FontSize() As Integer
Get
Dim o As Object = ViewState("FontSize")
If (IsNothing(o)) Then
Return defaultFontSize
Else
Return CInt(ViewState("FontSize"))
End If
End Get
Set(ByVal value As Integer)
ViewState("FontSize") = value
End Set
End Property
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub Render(ByVal Output As HtmlTextWriter)
Output.Write("<font size=" & Me.FontSize & ">" & Me.Text & "</font>")
End Sub
End Class
End Namespace