ListControlDataBindingHandler.DataBindControl-Methode
Führt eine Datenbindung für das angegebene Steuerelement durch.
Namespace: System.Web.UI.Design.WebControls
Assembly: System.Design (in system.design.dll)
Syntax
'Declaration
Public Overrides Sub DataBindControl ( _
designerHost As IDesignerHost, _
control As Control _
)
'Usage
Dim instance As ListControlDataBindingHandler
Dim designerHost As IDesignerHost
Dim control As Control
instance.DataBindControl(designerHost, control)
public override void DataBindControl (
IDesignerHost designerHost,
Control control
)
public:
virtual void DataBindControl (
IDesignerHost^ designerHost,
Control^ control
) override
public void DataBindControl (
IDesignerHost designerHost,
Control control
)
public override function DataBindControl (
designerHost : IDesignerHost,
control : Control
)
Parameter
- designerHost
Der IDesignerHost für das Dokument mit dem Steuerelement.
- control
Das zu bindende Control.
Hinweise
Wenn für das durch control angegebene ListControl-Steuerelement in der DataBindings-Eigenschaft eine Datenquelle angegeben wurde, löscht die DataBindControl-Methode die Items-Auflistung des ListControl und fügt anschließend eine Zeichenfolgenmeldung hinzu, die angibt, dass das ListControl an die Daten der Items-Auflistung gebunden wird.
Beispiel
Im folgenden Codebeispiel wird veranschaulicht, wie die DataBindControl-Methode überschrieben wird, um dem zugeordneten SimpleRadioButtonList
-Steuerelement bei der Datenbindung eine Zeichenfolgenmeldung hinzuzufügen.
Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die ListControlDataBindingHandler-Klasse.
' Override the DataBindControl.
Public Overrides Sub DataBindControl( _
ByVal designerHost As IDesignerHost, _
ByVal control As Control)
' Create a reference, named dataSourceBinding,
' to the control's DataSource binding.
Dim dataSourceBinding As DataBinding _
= CType( _
control, _
IDataBindingsAccessor).DataBindings("DataSource")
' If the binding exists, create a reference to the
' list control, clear its ListItemCollection, and then add
' an item to the collection.
If Not (dataSourceBinding Is Nothing) Then
Dim simpleControl As SimpleRadioButtonList = _
CType(control, SimpleRadioButtonList)
simpleControl.Items.Clear()
simpleControl.Items.Add("Data-bound Radio Button.")
End If
End Sub ' DataBindControl
// Override the DataBindControl.
public override void DataBindControl(IDesignerHost designerHost,
Control control)
{
// Create a reference, named dataSourceBinding,
// to the control DataSource binding.
DataBinding dataSourceBinding =
((IDataBindingsAccessor)control).DataBindings["DataSource"];
// If the binding exists, create a reference to the
// list control, clear its ListItemCollection, and then add
// an item to the collection.
if (! (dataSourceBinding == null))
{
SimpleRadioButtonList simpleControl =
(SimpleRadioButtonList)control;
simpleControl.Items.Clear();
simpleControl.Items.Add("Data-bound Radio Button.");
}
} // DataBindControl
.NET Framework-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .
Plattformen
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
ListControlDataBindingHandler-Klasse
ListControlDataBindingHandler-Member
System.Web.UI.Design.WebControls-Namespace
ListControl
Items
DataBindings
DataBindingHandler.DataBindControl