DataRepeater.ItemsAdded Event

Occurs when a new DataRepeaterItem is added to a DataRepeater control.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)


Public Event ItemsAdded As DataRepeaterAddRemoveItemsEventHandler
Dim instance As DataRepeater 
Dim handler As DataRepeaterAddRemoveItemsEventHandler 

AddHandler instance.ItemsAdded, handler
public event DataRepeaterAddRemoveItemsEventHandler ItemsAdded
 event DataRepeaterAddRemoveItemsEventHandler^ ItemsAdded {
    void add (DataRepeaterAddRemoveItemsEventHandler^ value);
    void remove (DataRepeaterAddRemoveItemsEventHandler^ value);
JScript does not support events.


The ItemsAdded event is raised when a request is made to add a new item, before the new item is displayed. Use this event to retrieve the index for the new item from the DataRepeaterAddRemoveItemsEventArgs.

In virtual mode, this event occurs before the ItemValuePushed event and can be used to create new records in your data store that you can then populate in the ItemValuePushed event handler.

For more information about how to handle events, see Consuming Events.


The following example demonstrates how to retrieve the index for a new item in a DataRepeater control.

Private Sub DataRepeater1_ItemsAdded(ByVal sender As Object, _
 ByVal e As  _
 Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsEventArgs) _
 Handles DataRepeater1.ItemsAdded
    MsgBox("New item: " & CStr(e.ItemIndex))
End Sub
private void dataRepeater1_ItemsAdded(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsEventArgs e)
    string itemNumber;
    itemNumber = e.ItemIndex.ToString();
    MessageBox.Show("New item: " + itemNumber);

.NET Framework Security

See Also


DataRepeater Class

DataRepeater Members

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

Virtual Mode in the DataRepeater Control (Visual Studio)