本文整理汇总了VB.NET中System.Web.UI.WebControls.ControlIDConverter类的典型用法代码示例。如果您正苦于以下问题:VB.NET ControlIDConverter类的具体用法?VB.NET ControlIDConverter怎么用?VB.NET ControlIDConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ControlIDConverter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: New
' 导入命名空间
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace Samples.AspNet.VB
<DefaultProperty("ControlID")> _
Public Class DebugInfoControl
Inherits Control
Public Sub New()
End Sub
Public Sub New(controlID As String)
ControlID = controlID
End Sub
<DefaultValue(""), TypeConverter(GetType(ControlIDConverter))> _
Public Property ControlID() As String
Get
Dim o As Object = ViewState("ControlID")
If o Is Nothing Then
Return String.Empty
End If
Return CStr(o)
End Get
Set
If ControlID <> value Then
ViewState("ControlID") = value
End If
End Set
End Property
Protected Overrides Sub Render(writer As HtmlTextWriter)
Dim info As New Label()
If Me.ControlID.Length = 0 Then
writer.Write("<Font Color='Red'>No ControlID set.</Font>")
End If
Dim ctrl As Control = Me.FindControl(ControlID)
If ctrl Is Nothing Then
writer.Write(("<Font Color='Red'>Could not find control " + ControlID + " in Naming Container.</Font>"))
Else
writer.Write(("<Font Color='Green'>Control " + ControlID + " found.<BR>"))
writer.Write(("Its Naming Container is: " + ctrl.NamingContainer.ID + "<BR>"))
If ctrl.EnableViewState Then
writer.Write("It uses view state to persist its state.<BR>")
End If
If ctrl.EnableTheming Then
writer.Write("It can be assigned a Theme ID.<BR>")
End If
If ctrl.Visible Then
writer.Write("It is visible on the page.<BR>")
Else
writer.Write("It is not visible on the page.<BR>")
End If
writer.Write("</Font>")
End If
End Sub
End Class
End Namespace