本文整理匯總了VB.NET中System.Web.UI.ControlBuilderAttribute類的典型用法代碼示例。如果您正苦於以下問題:VB.NET ControlBuilderAttribute類的具體用法?VB.NET ControlBuilderAttribute怎麽用?VB.NET ControlBuilderAttribute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ControlBuilderAttribute類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: AddParsedSubObject
'File name: controlBuilderAttribute.vb.
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections
Namespace CustomControls
Public Class MyVB_Item: Inherits Control
Private _message As String
Public Property Message() As String
Get
Return _message
End Get
Set
_message = value
End Set
End Property
End Class
Public Class VB_CustomParseControlBuilder: Inherits ControlBuilder
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Public Overrides Function GetChildControlType(TagName As String, attributes As IDictionary) As Type
If (TagName = "customitem") Then
Return GetType(CustomControls.MyVB_Item)
End If
Return Nothing
End Function 'GetChildControlType
End Class
<ControlBuilderAttribute(GetType(VB_CustomParseControlBuilder))> Public Class MyVB_CustomParse: Inherits Control
Private _items As New ArrayList
Private _selectedIndex As Integer = 0
Public Property SelectedIndex() As Integer
Get
Return _selectedIndex
End Get
Set
_selectedIndex = value
End Set
End Property
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub AddParsedSubObject(obj As Object)
If TypeOf obj Is MyVB_Item Then
_items.Add(obj)
End If
End Sub
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub Render(output As HtmlTextWriter)
output.Write(("<span style='background-color:aqua; color:red; font:8pt tahoma, verdana;'><b>" + CType(_items(SelectedIndex), MyVB_Item).Message + "</b></span>"))
End Sub
End Class
End Namespace 'CustomControls