ControlCollection.Count 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 ASP.NET 서버 컨트롤에 ControlCollection 대한 개체의 서버 컨트롤 수를 가져옵니다.
public:
property int Count { int get(); };
public:
virtual property int Count { int get(); };
public int Count { get; }
public virtual int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
Public Overridable ReadOnly Property Count As Integer
속성 값
의 서버 컨트롤 수 ControlCollection입니다.
구현
예제
다음 코드 예제에서는 컨트롤의 ControlCollection 개체를 Count 반복 하는 속성을 사용 하는 방법을 보여 줍니다. 속성을 사용하면 Control.HasControls() 컨트롤에 자식 컨트롤이 있음을 확인합니다. 반환false되는 경우 Control.HasControls 나머지 코드는 실행되지 않습니다.
if (HasControls()) {
for (int i=0; i < Controls.Count; i++) {
Controls[i].RenderControl(writer);
}
}
If HasControls() Then
Dim i As Integer
For i = 0 To Controls.Count - 1
Controls(i).RenderControl(writer)
Next i
End If