DataBinding.PropertyName 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取要将数据绑定到的 ASP.NET 服务器控件属性的名称。
public:
property System::String ^ PropertyName { System::String ^ get(); };
public string PropertyName { get; }
member this.PropertyName : string
Public ReadOnly Property PropertyName As String
属性值
要数据绑定到的属性。
示例
下面的代码示例声明三个变量 dataBindingOutput1
、 dataBindingOutput2
和 dataBindingOutput3
,它们访问 对象myDataBinding2
的不同属性 。DataBinding 然后,它将属性dataBindingOutput1
的值PropertyName分配给 ,将其与字符串“属性名称为”连接,并将该值写入文件。
// 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