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)

Syntax

public event DataRepeaterAddRemoveItemsEventHandler ItemsAdded
public:
event DataRepeaterAddRemoveItemsEventHandler^ ItemsAdded {
    void add(DataRepeaterAddRemoveItemsEventHandler^ value);
    void remove(DataRepeaterAddRemoveItemsEventHandler^ value);
}
member ItemsAdded : IEvent<DataRepeaterAddRemoveItemsEventHandler,
    DataRepeaterAddRemoveItemsEventArgs>
Public Event ItemsAdded As DataRepeaterAddRemoveItemsEventHandler

Remarks

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 Handling and Raising Events.

Examples

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

private void dataRepeater1_ItemsAdded(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsEventArgs e)
{
    string itemNumber;
    itemNumber = e.ItemIndex.ToString();
    MessageBox.Show("New item: " + itemNumber);
}
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

See Also

DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)
Virtual Mode in the DataRepeater Control (Visual Studio)

Return to top