TemplateContainerAttribute.BindingDirection 속성

정의

컨테이너 컨트롤의 바인딩 방향을 가져옵니다.

public:
 property System::ComponentModel::BindingDirection BindingDirection { System::ComponentModel::BindingDirection get(); };
public System.ComponentModel.BindingDirection BindingDirection { get; }
member this.BindingDirection : System.ComponentModel.BindingDirection
Public ReadOnly Property BindingDirection As BindingDirection

속성 값

BindingDirection

컨테이너 컨트롤의 바인딩 방향을 나타내는 BindingDirection입니다. 기본값은 OneWay입니다.

예제

다음 코드 예제에서는 명명 된 템플릿 컨트롤을 만들고 명명 TemplatedFirstControl FirstTemplateContainer된 컨테이너와 연결 하는 방법을 보여 줍니다. 이렇게 하면 템플릿이 지정되지 않은 서버 시간과 템플릿이 지정된 경우 템플릿의 내용을 표시하는 사용자 지정 컨트롤을 만들 수 있습니다. 메서드는 GetCustomAttribute . BindingDirection 의 속성 속성을 FirstTemplate TemplateFirstControl결정합니다.

이 코드 예제는에 대해 제공 된 큰 예제의 일부는 TemplateContainerAttribute 클래스입니다.

// Get the class type for which to access metadata.
Type clsType = typeof(TemplatedFirstControl);
// Get the PropertyInfo object for FirstTemplate.
PropertyInfo pInfo = clsType.GetProperty("FirstTemplate");
// See if the TemplateContainer attribute is defined for this property.
bool isDef = Attribute.IsDefined(pInfo, typeof(TemplateContainerAttribute));
// Display the result if the attribute exists.
if (isDef)
{
  TemplateContainerAttribute tca =
    (TemplateContainerAttribute)Attribute.GetCustomAttribute(pInfo, typeof(TemplateContainerAttribute));
  Response.Write("The binding direction is: " + tca.BindingDirection.ToString());
}
' Get the class type for which to access metadata.
Dim clsType As Type = GetType(VB_TemplatedFirstControl)
' Get the PropertyInfo object for FirstTemplate.
Dim pInfo As PropertyInfo = clsType.GetProperty("FirstTemplate")
' See if the TemplateContainer attribute is defined for this property.
Dim isDef As Boolean = Attribute.IsDefined(pInfo, GetType(TemplateContainerAttribute))
' Display the result if the attribute exists.
If isDef Then
  Dim tca As TemplateContainerAttribute = CType(Attribute.GetCustomAttribute(pInfo, GetType(TemplateContainerAttribute)), TemplateContainerAttribute)
  Response.Write("The binding direction is: " & tca.BindingDirection.ToString())
End If

설명

속성은 BindingDirection 템플릿이 OneWay 속성 값만 허용할 수 있는 필드 또는 TwoWay 템플릿이 속성 값을 수락하고 노출할 수 있는 필드일 수 있습니다. 후자의 시나리오에서 데이터 바인딩된 컨트롤은 데이터 바인딩 구문을 사용하여 Bind 데이터 원본의 업데이트, 삭제 및 삽입 작업을 자동으로 사용할 수 있습니다.

데이터 바인딩에 대한 자세한 내용은 데이터베이스에 바인딩데이터 바인딩 식 개요를 참조하세요.

적용 대상

추가 정보