コレクション内の指定したインデックス位置の RepeaterItem オブジェクトを取得します。
[C#] C# では、このプロパティは RepeaterItemCollection クラスのインデクサになります。
Public Default ReadOnly Property Item( _
ByVal index As Integer _) As RepeaterItem
[C#]
public RepeaterItem this[intindex] {get;}
[C++]
public: __property RepeaterItem* get_Item(intindex);
[JScript]
returnValue = RepeaterItemCollectionObject.Item(index);またはreturnValue = RepeaterItemCollectionObject(index);
[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。
引数 [JScript]
- index
コレクションから取得する RepeaterItem オブジェクトの 0 から始まるインデックス番号。
パラメータ [Visual Basic, C#, C++]
- index
コレクションから取得する RepeaterItem オブジェクトの 0 から始まるインデックス番号。
プロパティ値
コレクション内の指定したインデックス位置の RepeaterItem オブジェクト。
解説
このインデクサを使用して、配列表記で指定したインデックス位置にある RepeaterItemCollection から RepeaterItem オブジェクトを取得します。
使用例
<!--
To see this snippet in the context of a complete example,
see the RepeaterItemCollection class topic.
-->
. . .
Sub Item_Clicked(Sender As [Object], e As EventArgs)
labelDisplay.Text = "Using item indexer.<br>"
labelDisplay.Text += "The Items collection contains: <br>"
' Display the elements of the RepeaterItemCollection using the indexer.
Dim myItemCollection As RepeaterItemCollection = myRepeater.Items
Dim index As Integer
For index = 0 To myItemCollection.Count - 1
labelDisplay.Text += CType(myItemCollection(index).Controls(0), DataBoundLiteralControl).Text + "<br>"
Next index
End Sub 'Item_Clicked
[C#]
<!--
To see this snippet in the context of a complete example,
see the RepeaterItemCollection class topic.
-->
. . .
void Item_Clicked(Object Sender, EventArgs e)
{
labelDisplay.Text = "Using item indexer.<br>";
labelDisplay.Text += "The Items collection contains: <br>";
// Display the elements of the RepeaterItemCollection using the indexer.
RepeaterItemCollection myItemCollection = myRepeater.Items;
for(int index=0;index < myItemCollection.Count;index++)
labelDisplay.Text += ((DataBoundLiteralControl)
myItemCollection[index].Controls[0]).Text + "<br>";
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン
をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
参照
RepeaterItemCollection クラス | RepeaterItemCollection メンバ | System.Web.UI.WebControls 名前空間 | RepeaterItem