Proprietà DataRepeaterAddRemoveItemsCancelEventArgs.ItemCount
Ottiene il numero di elementi da eliminare.
Spazio dei nomi: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintassi
'Dichiarazione
Public ReadOnly Property ItemCount As Integer
public int ItemCount { get; }
public:
property int ItemCount {
int get ();
}
member ItemCount : int with get
function get ItemCount () : int
Valore proprietà
Tipo: Int32
Conteggio degli elementi.
Note
Nell'implementazione corrente del controllo di DataRepeater, un solo elemento può essere eliminato alla volta. Pertanto, questa proprietà sempre restituire 1.
Esempi
Nell'esempio seguente viene illustrato come annullare l'eliminazione nel gestore eventi di DeletingItems.
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.");
}
}
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per altre informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.
Vedere anche
Riferimenti
DataRepeaterAddRemoveItemsCancelEventArgs Classe
Spazio dei nomi Microsoft.VisualBasic.PowerPacks
Altre risorse
Introduzione al controllo DataRepeater (Visual Studio)
Procedura: disabilitare l'aggiunta e l'eliminazione di elementi DataRepeater (Visual Studio)