HyperLinkDataBindingHandler 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供超链接属性的数据绑定处理程序。
public ref class HyperLinkDataBindingHandler : System::Web::UI::Design::DataBindingHandler
public class HyperLinkDataBindingHandler : System.Web.UI.Design.DataBindingHandler
type HyperLinkDataBindingHandler = class
inherit DataBindingHandler
Public Class HyperLinkDataBindingHandler
Inherits DataBindingHandler
- 继承
示例
下面的代码示例创建一个名为, CustomHyperLinkDataBindingHandler
派生自该类的 HyperLinkDataBindingHandler
类。 它使用DataBindControl该方法解析类的设计时数据绑定CustomHyperLink
。
// Derive a class from the HyperLinkDataBindingHandler. It will
// resolve data binding for the CustomHyperlink at design time.
public class CustomHyperLinkDataBindingHandler :
HyperLinkDataBindingHandler
{
// Override the DataBindControl to set property values in
// the DataBindingCollection at design time.
public override void DataBindControl(IDesignerHost designerHost,
Control control)
{
DataBindingCollection bindings =
((IDataBindingsAccessor)control).DataBindings;
DataBinding imageBinding = bindings["ImageUrl"];
// If Text is empty, supply a default value.
if (!(imageBinding == null))
{
CustomHyperLink hype = (CustomHyperLink)control;
hype.ImageUrl = "Image URL.";
}
// Call the base method to bind the control.
base.DataBindControl(designerHost, control);
} // DataBindControl
} // CustomHyperLinkDataBindingHandler
' Derive a class from the HyperLinkDataBindingHandler. It will
' resolve data binding for the CustomHyperlink at design time.
Public Class CustomHyperLinkDataBindingHandler
Inherits HyperLinkDataBindingHandler
' Override the DataBindControl to set property values in
' the DataBindingCollection at design time.
Public Overrides Sub DataBindControl( _
ByVal designerHost As IDesignerHost, ByVal 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
构造函数
HyperLinkDataBindingHandler() |
初始化 HyperLinkDataBindingHandler 类的实例。 |
方法
DataBindControl(IDesignerHost, Control) |
为指定控件解析设计时数据绑定。 |
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
GetHashCode() |
作为默认哈希函数。 (继承自 Object) |
GetType() |
获取当前实例的 Type。 (继承自 Object) |
MemberwiseClone() |
创建当前 Object 的浅表副本。 (继承自 Object) |
ToString() |
返回表示当前对象的字符串。 (继承自 Object) |