Friday, August 14, 2009

What is ItemCommand ?

Dev Palmistry

DataGrid.ItemCommand Event


System.Web.UI.WebControls Namespace DataGrid Class

Occurs when a button within a DataGrid control is clicked.

[ VB ]
Public Event ItemCommand As DataGridCommandEventHandler

[ C# ]
public event DataGridCommandEventHandler ItemCommand;

[ C++ ]
public: __event DataGridCommandEventHandler* ItemCommand;

In [ JScript ], you can handle the events defined by a class, but you cannot define your own.
Remarks

The ItemCommand event is raised whenever any button associated with an item in the DataGrid is clicked. This provides for programmatically determining which specific command button is clicked and take appropriate action. This event is commonly used to handle button controls with a given CommandName value in the DataGrid control.
Event Data

Information related to the ItemCommand event is passed via a DataGridCommandEventArgs object to the method assigned to handle the event. The following DataGridCommandEventArgs properties provide information specific to this event.
Property Description
CommandSource Gets the source of the command.
Item Gets the DataGridItem associated with the event.

No comments: