Export (0) Print
Expand All

ListCommandEventArgs Class

Provides data for the ItemCommand event of a List control.

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in system.web.mobile.dll)

public class ListCommandEventArgs : CommandEventArgs
public class ListCommandEventArgs extends CommandEventArgs
public class ListCommandEventArgs extends CommandEventArgs
Not applicable.

The following code example shows how you can use the ListCommandEventArgs object to modify the status of tasks in a list when the item is clicked. This example is part of a larger example for the List overview.


The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Code Model.

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";
        case "pending":
            pendCount -= 1;
            doneCount += 1;
            e.ListItem.Value = "done";

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

    // Show current selection counts
    Label2.Text = String.Format(spec, doneCount, 
        schedCount, pendCount);


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1

Community Additions

© 2015 Microsoft