HyperLinkDataBindingHandler.DataBindControl Method
Data binds the specified control.
[Visual Basic] Overrides Public Sub DataBindControl( _ ByVal designerHost As IDesignerHost, _ ByVal control As Control _ ) [C#] public override void DataBindControl( IDesignerHost designerHost, Control control ); [C++] public: void DataBindControl( IDesignerHost* designerHost, Control* control ); [JScript] public override function DataBindControl( designerHost : IDesignerHost, control : Control );
Parameters
- designerHost
- The IDesignerHost for the document that contains the control.
- control
- The Control to data bind.
Remarks
This method determines whether the Text and NavigateUrl properties of the HyperLink control are data-bound. If the property is data-bound, this method sets the value of the Text property to "DataBound" and if the NavigateUrl property is data-bound, this method sets the value of the property to a text string so the control will have the appearance of a working hyperlink.
Example
[Visual Basic] The following code example creates a class, named CustomHyperLinkDataBindingHandler, that derives from the HyperLinkDataBindingHandler class. It resolves design-time data binding for the ImageUrl property of the CustomHyperLink class so that placeholder text is displayed for the property when it is databound at design time.
[Visual Basic]
' Create a class that derives from the
' HyperLinkDataBindingHandler class. This
' will resolve data binding for the CustomHyperlink
' class at design time.
Public Class CustomHyperLinkDataBindingHandler
Inherits HyperLinkDataBindingHandler
' Override the DataBindControl method to set property
' values in the control's DataBindingCollection object
' at design time.
Public Overrides Sub DataBindControl(designerHost As IDesignerHost, control As Control)
Dim bindings As DataBindingCollection = CType(control, IDataBindingsAccessor).DataBindings
Dim imageBinding As DataBinding = bindings("ImageUrl")
If Not (imageBinding Is Nothing) Then
Dim hLink As CustomHyperLink = CType(control, CustomHyperLink)
hLink.ImageUrl = "Image Url."
End If
MyBase.DataBindControl(designerHost, control)
End Sub
End Class
[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
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
HyperLinkDataBindingHandler Class | HyperLinkDataBindingHandler Members | System.Web.UI.Design Namespace