다음을 통해 공유


DataBinding.PropertyName 속성

정의

데이터 바인딩될 ASP.NET 서버 컨트롤 속성의 이름을 가져옵니다.

public:
 property System::String ^ PropertyName { System::String ^ get(); };
public string PropertyName { get; }
member this.PropertyName : string
Public ReadOnly Property PropertyName As String

속성 값

String

데이터 바인딩될 속성입니다.

예제

다음 코드 예제에서는 3 개의 변수 선언 dataBindingOutput1, dataBindingOutput2, 및 dataBindingOutput3의 다른 속성에 액세스 하는 DataBinding 개체 myDataBinding2합니다. 다음 값을 할당 합니다 PropertyName 속성을 dataBindingOutput1, 문자열을 사용 하 여 연결 "속성 이름이" 인 파일에 값을 씁니다.

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

적용 대상