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)

System.Object
  System.EventArgs
    System.ComponentModel.CancelEventArgs
      Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsCancelEventArgs

public class DataRepeaterAddRemoveItemsCancelEventArgs : CancelEventArgs

NameDescription
System_CAPS_pubmethodDataRepeaterAddRemoveItemsCancelEventArgs(Int32, Int32)

Initializes a new instance of the DataRepeaterAddRemoveItemsCancelEventArgs class.

NameDescription
System_CAPS_pubpropertyCancel

(Inherited from CancelEventArgs.)

System_CAPS_pubpropertyItemCount

Gets the number of items being deleted.

System_CAPS_pubpropertyItemIndex

Gets the index of the item that is being deleted.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(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 =
        System.Threading.Thread.CurrentPrincipal
        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.

Return to top
Show: