DataBinding.PropertyName Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the name of the ASP.NET server control property to bind data to.
public:
property System::String ^ PropertyName { System::String ^ get(); };
public string PropertyName { get; }
member this.PropertyName : string
Public ReadOnly Property PropertyName As String
Property Value
The property to bind data to.
Examples
The following code example declares three variables, dataBindingOutput1
, dataBindingOutput2
, and dataBindingOutput3
, which access the different properties of a DataBinding object, myDataBinding2
. It then assigns the value of the PropertyName property to dataBindingOutput1
, concatenates it with the string "The property name 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
' 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
Applies to
.NET