ListCommandEventArgs 类

定义

注意

The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.

ItemCommand 控件的 List 事件提供数据。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 ASP.NET 的网站

public ref class ListCommandEventArgs : System::Web::UI::WebControls::CommandEventArgs
public class ListCommandEventArgs : System.Web.UI.WebControls.CommandEventArgs
[System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class ListCommandEventArgs : System.Web.UI.WebControls.CommandEventArgs
type ListCommandEventArgs = class
    inherit CommandEventArgs
[<System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")>]
type ListCommandEventArgs = class
    inherit CommandEventArgs
Public Class ListCommandEventArgs
Inherits CommandEventArgs
继承
ListCommandEventArgs
属性

示例

下面的代码示例演示如何使用 ListCommandEventArgs 对象在单击项时修改列表中任务的状态。 此示例是概述的较大示例的 List 一部分。

注意

下面的代码示例使用单文件代码模型,如果直接复制到代码隐藏文件中,可能无法正常工作。 必须将此代码示例复制到扩展名为 .aspx 的空文本文件中。 有关详细信息,请参阅 ASP.NET Web Forms页代码模型

private void Status_ItemCommand(object sender, 
    ListCommandEventArgs e)
{
    const string spec = "You now have {0} " + 
        "tasks done, {1} tasks scheduled, and " +
        "{2} tasks pending.";

    // Move selection to next status toward 'done'
    switch (e.ListItem.Value)
    {
        case "scheduled":
            schedCount -= 1;
            pendCount += 1;
            e.ListItem.Value = "pending";
            break;
        case "pending":
            pendCount -= 1;
            doneCount += 1;
            e.ListItem.Value = "done";
            break;
    }

    // Show the status of the current task
    Label1.Text = e.ListItem.Text + " is " +
        e.ListItem.Value;

    // Show current selection counts
    Label2.Text = String.Format(spec, doneCount, 
        schedCount, pendCount);
}
Private Sub Status_ItemCommand(ByVal sender As Object, _
    ByVal e As ListCommandEventArgs)

    Const spec As String = "You now have {0} tasks done, {1} " & _
        "tasks scheduled, and {2} tasks pending."

    ' Move selection to next status toward 'done'
    Select Case e.ListItem.Value
        Case "scheduled"
            schedCount -= 1
            pendCount += 1
            e.ListItem.Value = "pending"
        Case "pending"
            pendCount -= 1
            doneCount += 1
            e.ListItem.Value = "done"
            
    End Select

    ' Show the status of the current task
    Label1.Text = e.ListItem.Text & " is " & _
        e.ListItem.Value

    ' Show current selection counts
    Label2.Text = String.Format(spec, doneCount, _
        schedCount, pendCount)
End Sub

构造函数

ListCommandEventArgs(MobileListItem, Object)
已过时.

使用提供的 ListCommandEventArgsListItem 初始化 CommandSource 类的新实例。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 ASP.NET 的网站

ListCommandEventArgs(MobileListItem, Object, CommandEventArgs)
已过时.

使用给定的 ListCommandEventArgsListItem 和原始的命令参数初始化 CommandSource 类的新实例。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 ASP.NET 的网站

字段

DefaultCommand
已过时.

设置或返回默认命令的名称。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 ASP.NET 的网站

属性

CommandArgument
已过时.

获取命令的参数。

(继承自 CommandEventArgs)
CommandName
已过时.

获取命令的名称。

(继承自 CommandEventArgs)
CommandSource
已过时.

返回引发事件的控件。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 ASP.NET 的网站

ListItem
已过时.

返回生成了事件的列表项。 此 API 已废弃不用。 有关如何开发 ASP.NET 移动应用程序的信息,请参阅 移动应用 & 具有 ASP.NET 的网站

方法

Equals(Object)
已过时.

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()
已过时.

作为默认哈希函数。

(继承自 Object)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()
已过时.

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅