DataControlRowState 열거형

정의

DetailsView 또는 GridView와 같은 데이터 컨트롤에 있는 행의 상태를 지정합니다.

이 열거형은 멤버 값의 비트 조합을 지원합니다.

public enum class DataControlRowState
[System.Flags]
public enum DataControlRowState
[<System.Flags>]
type DataControlRowState = 
Public Enum DataControlRowState
상속
DataControlRowState
특성

필드

Alternate 1

데이터 컨트롤 행이 교대로 반복되는 행임을 나타냅니다.

Alternate 상태는 다른 상태(예: Normal, Edit 또는 Insert)와 언제든지 결합할 수 있습니다. 이러한 행에서 영향을 받을 수는 AlternateRowStyle 속성 데이터의 제어 하는 경우 설정 합니다.

Edit 4

행이 편집 상태에 있음을 나타냅니다. 대개 행의 편집 단추를 클릭하면 이 상태가 됩니다. 일반적으로 EditInsert 상태는 함께 사용할 수 없습니다.

Insert 8

행이 새 행임을 나타냅니다. 대개 삽입 단추를 클릭하여 새 행을 추가하면 이 상태가 됩니다. 일반적으로 InsertEdit 상태는 함께 사용할 수 없습니다.

Normal 0

데이터 컨트롤 행이 표준 상태에 있음을 나타냅니다. Normal 상태는 Alternate 상태를 제외한 다른 상태와 함께 사용할 수 없습니다.

Selected 2

사용자가 행을 선택했음을 나타냅니다.

예제

다음 예제에서는 열거형을 사용하여 DataControlRowState 컨트롤의 행 GridView 상태에 따라 UI(사용자 인터페이스)를 렌더링하는 방법을 보여 줍니다. RadioButtonField 에서 파생 되는 사용자 지정 필드 컨트롤 클래스는 CheckBoxField 컨트롤에서의 모든 행에 대해 데이터 바인딩된 라디오 단추를 렌더링을 GridView 컨트롤입니다. 행 데이터가 사용자에 게 표시 되 고 편집 모드에 있지는 RadioButton 컨트롤을 사용할 수 있습니다. 사용자의 행을 업데이트 하는 경우 GridView 있으며 행이 편집 모드에는 RadioButton 컨트롤이 클릭할 수 있도록 설정 하는 대로 렌더링 됩니다. 이 예제에서는 행 상태 하나 이상의 조합일 수 있으므로 비트 AND 연산자를 사용 하 여 DataControlRowState 값입니다. 이 예제는에 대해 제공 된 큰 예제의 일부는 DataControlField 클래스입니다.

// This method adds a RadioButton control and any other 
// content to the cell's Controls collection.
protected override void InitializeDataCell
    (DataControlFieldCell cell, DataControlRowState rowState) {

  RadioButton radio = new RadioButton();

  // If the RadioButton is bound to a DataField, add
  // the OnDataBindingField method event handler to the
  // DataBinding event.
  if (DataField.Length != 0) {
    radio.DataBinding += new EventHandler(this.OnDataBindField);
  }

  radio.Text = this.Text;

  // Because the RadioButtonField is a BoundField, it only
  // displays data. Therefore, unless the row is in edit mode,
  // the RadioButton is displayed as disabled.
  radio.Enabled = false;
  // If the row is in edit mode, enable the button.
  if ((rowState & DataControlRowState.Edit) != 0 ||
      (rowState & DataControlRowState.Insert) != 0) {
    radio.Enabled = true;
  }

  cell.Controls.Add(radio);
}
' This method adds a RadioButton control and any other 
' content to the cell's Controls collection.
Protected Overrides Sub InitializeDataCell( _
    ByVal cell As DataControlFieldCell, _
    ByVal rowState As DataControlRowState)

    Dim radio As New RadioButton()

    ' If the RadioButton is bound to a DataField, add
    ' the OnDataBindingField method event handler to the
    ' DataBinding event.
    If DataField.Length <> 0 Then
        AddHandler radio.DataBinding, AddressOf Me.OnDataBindField
    End If

    radio.Text = Me.Text

    ' Because the RadioButtonField is a BoundField, it only 
    ' displays data. Therefore, unless the row is in edit mode, 
    ' the RadioButton is displayed as disabled.
    radio.Enabled = False
    ' If the row is in edit mode, enable the button.
    If (rowState And DataControlRowState.Edit) <> 0 _
        OrElse (rowState And DataControlRowState.Insert) <> 0 Then
        radio.Enabled = True
    End If

    cell.Controls.Add(radio)
End Sub

설명

합니다 DataControlRowState 열거와 같은 데이터 컨트롤에 있는 행의 상태를 식별 합니다 DetailsView 또는 GridView합니다. 하나 또는 조합을 행의 상태 수를 DataControlRowState 값, 따라서 사용 하 여 비트 연산의 행의 상태에 포함 되어 있는지 여부를 확인을 DataControlRowState 는 같음 여부를 테스트 하는 대신 값. 열거형은 DataControlRowState 행뿐만 DataRow 아니라 모든 유형의 행에 사용됩니다(일반적으로 머리글 및 바닥글 행의 상태는 로 설정 Normal됨).

사용할 수는 DataControlRowState 열거형의 상태를 식별 하는 GridViewRow 또는 DetailsViewRow 열거할 때 개체를 GridViewRowCollection 또는 DetailsViewRowCollection 컬렉션 각각. 행을 사용하는 데이터 컨트롤을 작성하는 경우 열거형을 사용하여 DataControlRowState 행(값)에 대해 다른 색을 렌더링할 시기 또는 행(AlternateInsert 값)을 편집할 수 있도록 설정되거나 사용하지 않도록 설정된 컨트롤을 Edit 식별할 수 있습니다.

적용 대상

추가 정보