DataRepeaterAddRemoveItemsCancelEventArgs.ItemCount 屬性
取得刪除的項目數目。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
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
屬性值
類型:Int32
項目的計數。
備註
在 DataRepeater 控制項的目前實作中,只有一個項目一次刪除。 因此,這個屬性一定會傳回 1。
範例
下列範例示範如何移除 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.");
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
DataRepeaterAddRemoveItemsCancelEventArgs 類別
Microsoft.VisualBasic.PowerPacks 命名空間