DataRepeaterAddRemoveItemsCancelEventArgs.ItemCount Property
Gets the number of items being deleted.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'宣言
Public ReadOnly Property ItemCount As Integer
Get
public int ItemCount { get; }
public:
property int ItemCount {
int get ();
}
member ItemCount : int
function get ItemCount () : int
Property Value
Type: System.Int32
A count of the items.
Remarks
In the current implementation of the DataRepeater control, only one item can be deleted at a time. Therefore, this property will always return 1.
Examples
The following example demonstrates how to cancel a deletion in the DeletingItems event handler.
Private Sub DataRepeater1_DeletingItems(
ByVal sender As Object,
ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsCancelEventArgs
) Handles DataRepeater1.DeletingItems
' Check whether the user is a supervisor.
If My.User.IsInRole("Supervisor") = False Then
' Cancel the deletion and display a message.
e.Cancel = True
MsgBox("You are not authorized to delete.")
End If
End Sub
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.");
}
}
.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
DataRepeaterAddRemoveItemsCancelEventArgs Class
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
Introduction to the DataRepeater Control (Visual Studio)
How to: Disable Adding and Deleting DataRepeater Items (Visual Studio)