DataRepeaterItem.ItemIndex Property
Gets the index of a DataRepeaterItem in a DataRepeater control.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property ItemIndex As Integer
Get
[BrowsableAttribute(false)]
public int ItemIndex { get; }
[BrowsableAttribute(false)]
public:
property int ItemIndex {
int get ();
}
[<BrowsableAttribute(false)>]
member ItemIndex : int
function get ItemIndex () : int
Property Value
Type: System.Int32
The index of the current DataRepeaterItem.
Remarks
Use this property to determine the index of each DataRepeaterItem as it is being processed in the DrawItem event of the DataRepeater control.
Examples
The following example demonstrates how to use the DrawItem event handler to display the ItemIndex for each item. It assumes that you have a form that contains a bound DataRepeater named DataRepeater1 with an unbound Label control named ItemLabel.
Private Sub DataRepeater1_DrawItem(
ByVal sender As Object,
ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs
) Handles DataRepeater1.DrawItem
' Display the ItemIndex in the label.
e.DataRepeaterItem.Controls("ItemLabel").Text =
CStr(e.DataRepeaterItem.ItemIndex)
End Sub
private void dataRepeater1_DrawItem(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs e)
{
// Display the ItemIndex in the label.
e.DataRepeaterItem.Controls["itemLabel"].Text = e.DataRepeaterItem.ItemIndex.ToString();
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace