This documentation is archived and is not being maintained.

HyperLinkDesigner Class

Extends design-time behavior for the HyperLink Web server control.

For a list of all members of this type, see HyperLinkDesigner Members.


[Visual Basic]
Public Class HyperLinkDesigner
   Inherits TextControlDesigner
public class HyperLinkDesigner : TextControlDesigner
public __gc class HyperLinkDesigner : public TextControlDesigner
public class HyperLinkDesigner extends TextControlDesigner

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.


The HyperLinkDesigner class overrides the GetDesignTimeHtml method of the ControlDesigner class to set any empty Text or NavigateUrl property on the control to ensure that the control is displayed with a meaningful representation at design time.


[Visual Basic] The following code example creates a class, named CustomHyperLinkDesigner, that inherits from the HyperLinkDesigner class and is meant to display the CustomHyperLink class at design time.

[Visual Basic] 
' Create a class, named CustomHyperLinkDesigner,
' that derives from the HyperLinkDesigner class.
' This new class displays the custom class,
' CustomHyperLink at design time.
 Public Class CustomHyperLinkDesigner
   Inherits HyperLinkDesigner
   ' Override the GetDesignTimeHtml method to set the 
   ' string property values of the CustomHyperLink class
   ' so that they will display at design time.
   Public Overrides Function GetDesignTimeHtml() As String
      Dim hl As CustomHyperLink = CType(Component, CustomHyperLink)
      Dim designTimeHtml As String = Nothing
      Dim text As String = hl.Text
      Dim noText As Boolean = (text.Trim().Length = 0)
         If noText Then
            hl.Text = "Click here."
         End If 
         designTimeHtml = MyBase.GetDesignTimeHtml()
      Catch e As New Exception()
         If noText Then
           hl.Text = text
         End If
      End Try
      If ((designTimeHtml = Nothing) Or (designTimeHtml.Length = 0)) Then
         designTimeHtml = GetEmptyDesignTimeHtml()
      End If
      Return designTimeHtml
   End Function 
 End Class

[Visual Basic] The following example uses the DesignerAttribute class to associate the CustomHyperLinkDesigner with the CustomHyperLink class.

[Visual Basic] 
Imports System
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Examples.AspNet

' Create a CustomHyperLink control  that uses the 
' CustomHyperLinkDesigner and CustomHyperLinkDataBindingHandler
' classes to display its contents at design time.
 <Designer("Examples.AspNet.Design.CustomHyperLinkDesigner", _
  "System.Web.UI.Design.WebControls.HyperLinkDesigner")> _
 Public Class SimpleHyperLink
   Inherits HyperLink
    ' Insert code for custom class here.
 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 Language Filter in the upper-left corner of the page.


Namespace: System.Web.UI.Design.WebControls

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Design (in System.Design.dll)

See Also

HyperLinkDesigner Members | System.Web.UI.Design.WebControls Namespace | HyperLink