ObjectList.ItemCommand Event

Occurs when the user selects a command that is associated with an ObjectList item.

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

public:
event ObjectListCommandEventHandler^ ItemCommand {
	void add (ObjectListCommandEventHandler^ value);
	void remove (ObjectListCommandEventHandler^ value);
}
/** @event */
public void add_ItemCommand (ObjectListCommandEventHandler value)

/** @event */
public void remove_ItemCommand (ObjectListCommandEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

When an ItemCommand event handler is defined, the ObjectList notifies the handler when an item event is generated through user interaction.

When you render an object list by using templates, the ItemCommand event handler is called through the event-bubbling mechanism of ASP.NET. The event handler is passed an argument of type ObjectListCommandEventArgs, which contains information about the source item and the CommandName property of the control that generated the event. This allows you to render a single item with multiple associated interactions.

On default rendering, the control renders each of the commands defined for the object list as a link. When the user clicks a link, the ItemCommand event handler is called with an argument of type ObjectListCommandEventArgs, which contains information about the source item. The value in the CommandName property is the name of the command that the user invoked.

The following code example demonstrates how to trap the ItemCommand event. The CommandName property specifies what action to perform.

NoteNote:

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.

No code example is currently available or this language may not be supported.

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

ADD
Show: