Export (0) Print
Expand All

DataBinding.PropertyType Property

Gets the .NET Framework type of the data-bound ASP.NET server control property.

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

public Type PropertyType { get; }

Property Value

Type: System.Type
The .NET Framework type of the data-bound property.

The following code example declares three variables, dataBindingOutput1, dataBindingOutput2, and dataBindingOutput3, which access the different properties of a DataBinding object, myDataBinding2. The PropertyType property value is assigned to dataBindingOutput2 and concatenated with the string "The property type is ", and writes the value to a file.

// 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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft