TextControlDesigner Class
Extends design-time behavior for the ASP.NET Label and HyperLink server controls.
For a list of all members of this type, see TextControlDesigner Members.
System.Object
System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.TextControlDesigner
System.Web.UI.Design.WebControls.HyperLinkDesigner
System.Web.UI.Design.WebControls.LabelDesigner
System.Web.UI.Design.WebControls.LinkButtonDesigner
[Visual Basic] Public Class TextControlDesigner Inherits ControlDesigner [C#] public class TextControlDesigner : ControlDesigner [C++] public __gc class TextControlDesigner : public ControlDesigner [JScript] public class TextControlDesigner extends ControlDesigner
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
This class can be used as the base class for designers for runtime controls that have a string Text property.
Example
[Visual Basic] The following code example shows a custom class, named CustomLabelDesigner, that derives from the LabelDesigner class. Because LabelDesigner derives directly from the TextControlDesigner class, it has access to the implementation of all the methods of the TextControlDesigner class. In this case, CustomLabelDesigner overrides the Initialize method to ensure that only objects that are instances of a CustomLabel class are created in the designer. It also overrides the Verbs property to add a designer verb, a custom method named OnPropertyBuilder, to the collection.
[Visual Basic]
Imports System
Imports System.Design
Imports System.Drawing
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports Examples.AspNet
Namespace Examples.AspNet.Design
Public Class SampleLabelDesigner
Inherits LabelDesigner
' Override the GetDesignTimeHtml method.
Public Overrides Function GetDesignTimeHtml() As String
Dim sampleLabel As SampleLabel = CType(Component, SampleLabel)
Dim designTimeHtml As String = Nothing
' Check the control's BorderStyle property
' to conditionally render design-time HTML.
If (sampleLabel.BorderStyle = BorderStyle.NotSet) Then
' Create variables to hold current property settings.
Dim oldBorderStyle As BorderStyle = sampleLabel.BorderStyle
' Set properties and the design-time HTML.
Try
sampleLabel.BorderStyle = BorderStyle.Dashed
designTimeHtml = MyBase.GetDesignTimeHtml()
' If an exception occurs, call the GetErrorDesignTimeHtml
' method.
Catch ex As Exception
designTimeHtml = GetErrorDesignTimeHtml(ex)
' Return properties to their original settings.
Finally
sampleLabel.BorderStyle = oldBorderStyle
End Try
Else
designTimeHtml = MyBase.GetDesignTimeHtml()
End If
Return designTimeHTML
End Function
End Class
End Namespace
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Web.UI.Design
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
Assembly: System.Design (in System.Design.dll)
See Also
TextControlDesigner Members | System.Web.UI.Design Namespace