ListViewCancelMode 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定用户在 “取消”按钮在 ListView 项中单击时执行的操作类型。
public enum class ListViewCancelMode
public enum ListViewCancelMode
type ListViewCancelMode =
Public Enum ListViewCancelMode
- 继承
字段
| 名称 | 值 | 说明 |
|---|---|---|
| CancelingEdit | 0 | 用户取消了编辑操作。 |
| CancelingInsert | 1 | 用户取消了插入操作。 |
示例
以下示例演示如何使用 ListViewCancelMode 枚举来检查项中 ListView 正在取消的操作。
protected void ContactsListView_ItemCanceling(object sender, ListViewCancelEventArgs e)
{
//Check the operation that raised the event
if (e.CancelMode == ListViewCancelMode.CancelingEdit)
{
// The update operation was canceled. Display the
// primary key of the item.
Message.Text = "Update for the ContactID " +
ContactsListView.DataKeys[e.ItemIndex].Value.ToString() + " canceled.";
}
else
{
Message.Text = "Insert operation canceled.";
}
}
Protected Sub ContactsListView_ItemCanceling(ByVal sender As Object, _
ByVal e As ListViewCancelEventArgs)
'Check the operation that raised the event
If (e.CancelMode = ListViewCancelMode.CancelingEdit) Then
' The update operation was canceled. Display the
' primary key of the item.
Message.Text = "Update for the ContactID " & _
ContactsListView.DataKeys(e.ItemIndex).Value.ToString() & " canceled."
Else
Message.Text = "Insert operation canceled."
End If
End Sub
注解
枚举ListViewCancelMode用于表示用户在项目中单击ListView按钮时正在执行的操作类型。 (“取消”按钮是一个按钮,其 CommandName 属性设置为“Cancel”。)