Freigeben über


DataBinding.PropertyType-Eigenschaft

Ruft den .NET Framework-Typ der datengebundenen Eigenschaft eines ASP.NET-Serversteuerelements ab.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

Syntax

'Declaration
Public ReadOnly Property PropertyType As Type
'Usage
Dim instance As DataBinding
Dim value As Type

value = instance.PropertyType
public Type PropertyType { get; }
public:
property Type^ PropertyType {
    Type^ get ();
}
/** @property */
public Type get_PropertyType ()
public function get PropertyType () : Type

Eigenschaftenwert

Der NET Framework-Typ der datengebundenen Eigenschaft.

Beispiel

Im folgenden Codebeispiel werden die drei Variablen dataBindingOutput1, dataBindingOutput2 und dataBindingOutput3 definiert, die auf die verschiedenen Eigenschaften eines DataBinding-Objekts mit dem Namen myDataBinding2 zugreifen. Der PropertyType-Eigenschaftenwert wird zu dataBindingOutput2 zugewiesen und mit der Zeichenfolge "The property type is " verkettet, und der Wert wird in eine Datei geschrieben.

    ' Use the DataBindingCollection.GetEnumerator method
    ' to iterate through the myDataBindingCollection object
    ' and write the PropertyName, PropertyType, and Expression
    ' properties to a file for each DataBinding object
    ' in the MyDataBindingCollection object. 
    myDataBindingCollection = DataBindings
    Dim myEnumerator As IEnumerator = myDataBindingCollection.GetEnumerator()

    While myEnumerator.MoveNext()
        myDataBinding2 = CType(myEnumerator.Current, DataBinding)
        Dim dataBindingOutput1, dataBindingOutput2, dataBindingOutput3 As [String]
        dataBindingOutput1 = [String].Concat("The property name is ", myDataBinding2.PropertyName)
        dataBindingOutput2 = [String].Concat("The property type is ", myDataBinding2.PropertyType.ToString(), "-", dataBindingOutput1)
        dataBindingOutput3 = [String].Concat("The expression is ", myDataBinding2.Expression, "-", dataBindingOutput2)
        WriteToFile(dataBindingOutput3)

        myDataBindingExpression2 = [String].Concat("<%#", myDataBinding2.Expression, "%>")
        myStringReplace2 = myDataBinding2.PropertyName.Replace(".", "-")
        myHtmlControlDesignBehavior.SetAttribute(myStringReplace2, myDataBindingExpression2)
        Dim index As Integer = myStringReplace2.IndexOf("-"c)
    End While ' while loop ends
End Sub 'OnBindingsCollectionChanged
// Use the DataBindingCollection.GetEnumerator method
// to iterate through the myDataBindingCollection object
// and write the PropertyName, PropertyType, and Expression
// properties to a file for each DataBinding object
// in the MyDataBindingCollection object. 
myDataBindingCollection = DataBindings;
IEnumerator myEnumerator = myDataBindingCollection.GetEnumerator();

while (myEnumerator.MoveNext())
{
    myDataBinding2 = (DataBinding)myEnumerator.Current;
    String dataBindingOutput1, dataBindingOutput2, dataBindingOutput3;
    dataBindingOutput1 = String.Concat("The property name is ", myDataBinding2.PropertyName);
    dataBindingOutput2 = String.Concat("The property type is ", myDataBinding2.PropertyType.ToString(), "-", dataBindingOutput1);
    dataBindingOutput3 = String.Concat("The expression is ", myDataBinding2.Expression, "-", dataBindingOutput2);
    WriteToFile(dataBindingOutput3);

    myDataBindingExpression2 = String.Concat("<%#", myDataBinding2.Expression, "%>");
    myStringReplace2 = myDataBinding2.PropertyName.Replace(".", "-");
    myHtmlControlDesignBehavior.SetAttribute(myStringReplace2, myDataBindingExpression2);
    int index = myStringReplace2.IndexOf('-');
}// while loop ends
// Use the DataBindingCollection.GetEnumerator method
// to iterate through the myDataBindingCollection object
// and write the PropertyName, PropertyType, and Expression
// properties to a file for each DataBinding object
// in the MyDataBindingCollection object. 
myDataBindingCollection = get_DataBindings();
IEnumerator myEnumerator = myDataBindingCollection.GetEnumerator();
while (myEnumerator.MoveNext()) {
    myDataBinding2 = (DataBinding)(myEnumerator.get_Current());
    String dataBindingOutput1, dataBindingOutput2, dataBindingOutput3;
    dataBindingOutput1 = String.Concat("The property name is ", 
        myDataBinding2.get_PropertyName());
    dataBindingOutput2 = String.Concat("The property type is ", 
        myDataBinding2.get_PropertyType().ToString(), "-", 
        dataBindingOutput1);
    dataBindingOutput3 = String.Concat("The expression is ", 
        myDataBinding2.get_Expression(), "-", dataBindingOutput2);
    WriteToFile(dataBindingOutput3);
    myDataBindingExpression2 = String.Concat("<%#", myDataBinding2.
        get_Expression(), "%>");
    myStringReplace2 = myDataBinding2.get_PropertyName().
        Replace(".", "-");
    myHtmlControlDesignBehavior.SetAttribute(myStringReplace2, 
        myDataBindingExpression2, true);
    int index = myStringReplace2.IndexOf("-");
} // while loop ends

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

DataBinding-Klasse
DataBinding-Member
System.Web.UI-Namespace