CatalogPartCollection.Item[] 속성

정의

위치와 고유 식별자에 따라 컬렉션의 특정 멤버를 반환합니다.

오버로드

Item[Int32]

컬렉션에서의 위치를 기준으로 컬렉션의 멤버를 가져오거나 설정합니다.

Item[String]

고유한 문자열 식별자를 기반으로 컬렉션의 멤버를 반환합니다.

Item[Int32]

컬렉션에서의 위치를 기준으로 컬렉션의 멤버를 가져오거나 설정합니다.

public:
 property System::Web::UI::WebControls::WebParts::CatalogPart ^ default[int] { System::Web::UI::WebControls::WebParts::CatalogPart ^ get(int index); };
public System.Web.UI.WebControls.WebParts.CatalogPart this[int index] { get; }
member this.Item(int) : System.Web.UI.WebControls.WebParts.CatalogPart
Default Public ReadOnly Property Item(index As Integer) As CatalogPart

매개 변수

index
Int32

컬렉션에 있는 특정 CatalogPart의 인덱스입니다.

속성 값

CatalogPart

컬렉션의 지정된 인덱스에 있는 CatalogPart입니다.

예제

다음 코드 예제에서는 인덱스를 사용하여 개체의 멤버에 액세스하는 CatalogPartCollection 방법을 보여 줍니다. 예제를 실행 하는 데 필요한 전체 코드의 예제 섹션을 참조 하세요.를 CatalogPartCollection 클래스 개요 항목입니다.

메서드의 Button1_Click 코드는 새 myParts개체를 CatalogPartCollection 만듭니다. 메서드는 인덱서로 Item[] 컬렉션의 첫 번째 멤버에서 정보를 검색합니다.

protected void Button1_Click(object sender, EventArgs e)
{
  ArrayList list = new ArrayList(2);
  list.Add(PageCatalogPart1);
  list.Add(DeclarativeCatalogPart1);
  // Pass an ICollection object to the constructor.
  CatalogPartCollection myParts = new CatalogPartCollection(list);
  foreach (CatalogPart catalog in myParts)
  {
    catalog.Description = "My " + catalog.DisplayTitle;
  }

  // Use the IndexOf property to locate a CatalogPart control.
  int PageCatalogPartIndex = myParts.IndexOf(PageCatalogPart1);
  myParts[PageCatalogPartIndex].ChromeType = PartChromeType.TitleOnly;

  // Use the Contains method to see if a CatalogPart control exists.
  if (myParts.Contains(PageCatalogPart1))
  {
    WebPart closedWebPart = null;
    WebPartDescriptionCollection descriptions = PageCatalogPart1.GetAvailableWebPartDescriptions();
    if (descriptions.Count > 0)
    {
      closedWebPart = PageCatalogPart1.GetWebPart(descriptions[0]);
      closedWebPart.AllowClose = false;
    }
  }
  
  // Use indexers to display the details of the CatalogPart controls.
  Label1.Text = String.Empty;
  Label1.Text =
    "<h3>PageCatalogPart Details</h3>" +
    "ID: " + myParts[0].ID + "<br />" +
    "Count: " + myParts[0].GetAvailableWebPartDescriptions().Count;
  Label1.Text += 
    "<h3>DeclarativeCatalogPart Details</h3>" +
    "ID: " + myParts["DeclarativeCatalogPart1"].ID + "<br />" +
    "Count: " + myParts["DeclarativeCatalogPart1"].GetAvailableWebPartDescriptions().Count;
}
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) 
    Dim list As New ArrayList(2)
    list.Add(PageCatalogPart1)
    list.Add(DeclarativeCatalogPart1)
    ' Pass an ICollection object to the constructor.
    Dim myParts As New CatalogPartCollection(list)
    Dim catalog As CatalogPart
    For Each catalog In  myParts
        catalog.Description = "My " + catalog.DisplayTitle
    Next catalog
    
    ' Use the IndexOf property to locate a CatalogPart control.
    Dim PageCatalogPartIndex As Integer = _
      myParts.IndexOf(PageCatalogPart1)
    myParts(PageCatalogPartIndex).ChromeType = PartChromeType.TitleOnly
    
    ' Use the Contains method to see if a CatalogPart control exists.
    If myParts.Contains(PageCatalogPart1) Then
        Dim closedWebPart As WebPart = Nothing
        Dim descriptions As WebPartDescriptionCollection = _
          PageCatalogPart1.GetAvailableWebPartDescriptions()
        If descriptions.Count > 0 Then
            closedWebPart = PageCatalogPart1.GetWebPart(descriptions(0))
            closedWebPart.AllowClose = False
        End If
    End If
    
    ' Use indexers to display the details of the CatalogPart controls.
    Label1.Text = String.Empty
    Label1.Text = _
      "<h3>PageCatalogPart Details</h3>" & _
      "ID: " & myParts(0).ID + "<br />" & _
      "Count: " & myParts(0).GetAvailableWebPartDescriptions().Count
    Label1.Text += _
      "<h3>DeclarativeCatalogPart Details</h3>" & _
      "ID: " & myParts("DeclarativeCatalogPart1").ID & "<br />" & _
      "Count: " & myParts("DeclarativeCatalogPart1") _
        .GetAvailableWebPartDescriptions().Count

End Sub 

브라우저에서 페이지를 로드할 때 표시 모드 드롭다운 목록 컨트롤에서 카탈로그를 선택하여 페이지를 카탈로그 모드 로 전환할 수 있습니다. CatalogPart 속성 표시 단추를 클릭하면 개체에 CatalogPartCollection 액세스하고 포함된 CatalogPart 컨트롤의 특정 속성이 표시됩니다. 메서드의 인덱서를 Button1_Click 사용하여 컨트롤 내에서 PageCatalogPart 사용 가능한 서버 컨트롤의 Item[] 수를 가져옵니다.

설명

Item[] 덱서는 인덱스를 통해 개체의 기본 CatalogPart 컨트롤에 CatalogPartCollection 액세스하고 해당 속성 값 또는 호출 메서드를 변경할 수 있습니다.

추가 정보

적용 대상

Item[String]

고유한 문자열 식별자를 기반으로 컬렉션의 멤버를 반환합니다.

public:
 property System::Web::UI::WebControls::WebParts::CatalogPart ^ default[System::String ^] { System::Web::UI::WebControls::WebParts::CatalogPart ^ get(System::String ^ id); };
public System.Web.UI.WebControls.WebParts.CatalogPart this[string id] { get; }
member this.Item(string) : System.Web.UI.WebControls.WebParts.CatalogPart
Default Public ReadOnly Property Item(id As String) As CatalogPart

매개 변수

id
String

컬렉션의 특정 CatalogPart에 대한 고유한 식별자입니다.

속성 값

CatalogPart

컬렉션에서 ID가 id 값과 동일한 첫 번째 CatalogPart입니다.

예제

다음 코드 예제에서는 문자열 ID 값을 사용 하 여 개체의 멤버에 CatalogPartCollection 액세스할 수 있는 방법을 보여 줍니다. 예제를 실행 하는 데 필요한 전체 코드의 예제 섹션을 참조 하세요.를 CatalogPartCollection 클래스 개요 항목입니다.

메서드의 Button1_Click 코드는 새 myParts개체를 CatalogPartCollection 만듭니다. 이 메서드 Item[] 는 인덱서로 컬렉션의 DeclarativeCatalogPart 두 번째 멤버인 컨트롤에 대한 정보를 검색합니다.

protected void Button1_Click(object sender, EventArgs e)
{
  ArrayList list = new ArrayList(2);
  list.Add(PageCatalogPart1);
  list.Add(DeclarativeCatalogPart1);
  // Pass an ICollection object to the constructor.
  CatalogPartCollection myParts = new CatalogPartCollection(list);
  foreach (CatalogPart catalog in myParts)
  {
    catalog.Description = "My " + catalog.DisplayTitle;
  }

  // Use the IndexOf property to locate a CatalogPart control.
  int PageCatalogPartIndex = myParts.IndexOf(PageCatalogPart1);
  myParts[PageCatalogPartIndex].ChromeType = PartChromeType.TitleOnly;

  // Use the Contains method to see if a CatalogPart control exists.
  if (myParts.Contains(PageCatalogPart1))
  {
    WebPart closedWebPart = null;
    WebPartDescriptionCollection descriptions = PageCatalogPart1.GetAvailableWebPartDescriptions();
    if (descriptions.Count > 0)
    {
      closedWebPart = PageCatalogPart1.GetWebPart(descriptions[0]);
      closedWebPart.AllowClose = false;
    }
  }
  
  // Use indexers to display the details of the CatalogPart controls.
  Label1.Text = String.Empty;
  Label1.Text =
    "<h3>PageCatalogPart Details</h3>" +
    "ID: " + myParts[0].ID + "<br />" +
    "Count: " + myParts[0].GetAvailableWebPartDescriptions().Count;
  Label1.Text += 
    "<h3>DeclarativeCatalogPart Details</h3>" +
    "ID: " + myParts["DeclarativeCatalogPart1"].ID + "<br />" +
    "Count: " + myParts["DeclarativeCatalogPart1"].GetAvailableWebPartDescriptions().Count;
}
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) 
    Dim list As New ArrayList(2)
    list.Add(PageCatalogPart1)
    list.Add(DeclarativeCatalogPart1)
    ' Pass an ICollection object to the constructor.
    Dim myParts As New CatalogPartCollection(list)
    Dim catalog As CatalogPart
    For Each catalog In  myParts
        catalog.Description = "My " + catalog.DisplayTitle
    Next catalog
    
    ' Use the IndexOf property to locate a CatalogPart control.
    Dim PageCatalogPartIndex As Integer = _
      myParts.IndexOf(PageCatalogPart1)
    myParts(PageCatalogPartIndex).ChromeType = PartChromeType.TitleOnly
    
    ' Use the Contains method to see if a CatalogPart control exists.
    If myParts.Contains(PageCatalogPart1) Then
        Dim closedWebPart As WebPart = Nothing
        Dim descriptions As WebPartDescriptionCollection = _
          PageCatalogPart1.GetAvailableWebPartDescriptions()
        If descriptions.Count > 0 Then
            closedWebPart = PageCatalogPart1.GetWebPart(descriptions(0))
            closedWebPart.AllowClose = False
        End If
    End If
    
    ' Use indexers to display the details of the CatalogPart controls.
    Label1.Text = String.Empty
    Label1.Text = _
      "<h3>PageCatalogPart Details</h3>" & _
      "ID: " & myParts(0).ID + "<br />" & _
      "Count: " & myParts(0).GetAvailableWebPartDescriptions().Count
    Label1.Text += _
      "<h3>DeclarativeCatalogPart Details</h3>" & _
      "ID: " & myParts("DeclarativeCatalogPart1").ID & "<br />" & _
      "Count: " & myParts("DeclarativeCatalogPart1") _
        .GetAvailableWebPartDescriptions().Count

End Sub 

브라우저에서 페이지를 로드할 때 표시 모드 드롭다운 목록 컨트롤에서 카탈로그를 선택하여 페이지를 카탈로그 모드 로 전환할 수 있습니다. CatalogPart 속성 표시 단추를 클릭하면 개체에 CatalogPartCollection 액세스하고 포함된 CatalogPart 컨트롤의 특정 속성이 표시됩니다. 메서드의 인덱서를 Button1_Click 사용하여 컨트롤 내에서 DeclarativeCatalogPart 사용 가능한 서버 컨트롤의 Item[] 수를 가져옵니다.

설명

Item[] 인덱서에서는 문자열 식별자를 사용하여 개체의 기본 CatalogPart 컨트롤 CatalogPartCollection 에 액세스할 수 있습니다. 개체가 CatalogPartCollection 읽기 전용이지만 인덱서에서 액세스하는 기본 컨트롤에서 속성 값을 변경하거나 메서드를 호출할 수 있습니다.

추가 정보

적용 대상