We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

DataRepeaterAddRemoveItemsCancelEventArgs Class

Provides data for the DeletingItems and UserDeletingItems events.


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

public class DataRepeaterAddRemoveItemsCancelEventArgs : CancelEventArgs

The DataRepeaterAddRemoveItemsCancelEventArgs type exposes the following members.

Public methodDataRepeaterAddRemoveItemsCancelEventArgsInitializes a new instance of the DataRepeaterAddRemoveItemsCancelEventArgs class.

Public propertyCancelGets or sets a value indicating whether the event should be canceled. (Inherited from CancelEventArgs.)
Public propertyItemCountGets the number of items being deleted.
Public propertyItemIndexGets the index of the item that is being deleted.

Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

The DeletingItems and UserDeletingItems events occur when a request is made to delete a DataRepeaterItem from a DataRepeater control.

You can override the deletion by setting the cancel parameter of the DataRepeaterAddRemoveItemsCancelEventArgs to True.

The following example demonstrates how to cancel a deletion in the DeletingItems event handler.

private void DataRepeater1_DeletingItems(object sender, 
    Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsCancelEventArgs e)
    // Check whether the user is a supervisor.

    ClientRolePrincipal rolePrincipal =
        as ClientRolePrincipal;

    if (rolePrincipal.IsInRole("supervisor") == false)
        e.Cancel = true;
        MessageBox.Show("You are not authorized to delete.");

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.