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