次の方法で共有


DataRepeaterAddRemoveItemsCancelEventArgs.ItemCount プロパティ

更新 : 2007 年 11 月

削除される項目の数を取得します。

名前空間 :  Microsoft.VisualBasic.PowerPacks
アセンブリ :  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
Public ReadOnly Property ItemCount As Integer
'使用
Dim instance As DataRepeaterAddRemoveItemsCancelEventArgs
Dim value As Integer

value = instance.ItemCount
public int ItemCount { get; }
public:
property int ItemCount {
    int get ();
}
public function get ItemCount () : int

プロパティ値

型 : System.Int32

項目の数。

解説

DataRepeater コントロールの現在の実装では、一度に 1 つの項目のみ削除できます。そのため、このプロパティは常に 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.");
    }
}   

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

DataRepeaterAddRemoveItemsCancelEventArgs クラス

DataRepeaterAddRemoveItemsCancelEventArgs メンバ

Microsoft.VisualBasic.PowerPacks 名前空間

DeletingItems

UserDeletingItems

その他の技術情報

DataRepeater コントロールの概要 (Visual Studio)

方法 : DataRepeater の項目の追加と削除を無効にする (Visual Studio)