本文整理匯總了VB.NET中System.Web.UI.IPostBackDataHandler接口的典型用法代碼示例。如果您正苦於以下問題:VB.NET IPostBackDataHandler接口的具體用法?VB.NET IPostBackDataHandler怎麽用?VB.NET IPostBackDataHandler使用的例子?那麽, 這裏精選的接口代碼示例或許可以為您提供幫助。
在下文中一共展示了IPostBackDataHandler接口的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: RaisePostDataChangedEvent
' 導入命名空間
Imports System.Web
Imports System.Web.UI
Imports System.Collections
Imports System.Collections.Specialized
Namespace CustomWebFormsControls
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> Public Class MyTextBox
Inherits Control
Implements IPostBackDataHandler
Public Property Text() As String
Get
Return CType(Me.ViewState("Text"), String)
End Get
Set
Me.ViewState("Text") = value
End Set
End Property
Public Event TextChanged As EventHandler
Public Overridable Shadows Function LoadPostData( _
postDataKey As String, _
postCollection As System.Collections.Specialized.NameValueCollection) _
As Boolean Implements IPostBackDataHandler.LoadPostData
Dim presentValue As String = Text
Dim postedValue As String = postCollection(postDataKey)
If presentValue Is Nothing Or Not presentValue.Equals(postedValue) Then
Text = postedValue
Return True
End If
Return False
End Function
Public Overridable Shadows Sub RaisePostDataChangedEvent() _
Implements IPostBackDataHandler.RaisePostDataChangedEvent
OnTextChanged(EventArgs.Empty)
End Sub
Protected Overridable Sub OnTextChanged(e As EventArgs)
RaiseEvent TextChanged(Me, e)
End Sub
Protected Overrides Sub Render(output As HtmlTextWriter)
output.Write("<INPUT type= text name = " & Me.UniqueID & _
" value = " & Me.Text & " >")
End Sub
End Class
End Namespace