Web server controls such as the Repeater, DataList, and DataGrid
controls can contain button controls that themselves raise events. For
example, each row in a DataGrid control can contain one or more buttons
created dynamically by templates.
Rather than each button raising an event individually, events from the
nested controls are bubbled - that is, they're sent to the container.
The container in turn raises a generic event called ItemCommand with
parameters that allow you to discover which individual control raised
the original event. By responding to this single event, you can avoid
having to write individual event handlers for child controls.
The ItemCommand event includes the two standard event arguments, an
object referencing the source of the event and an event object
containing event-specific information.
Note : The DataGrid and DataList Web server controls support
additional events, such as EditCommand, DeleteCommand, and
UpdateCommand, which are special cases of bubbled events.
With buttons, you can use the CommandArgument property to pass a
user-specified string to the event handler to help you identify what
button raised the event. For example, in a DataList control, buttons
raise the ItemCommand event. You can set the CommandArgument property
of each button to a different value - perhaps one button's value is
"ShowDetails" and another button's value is "AddToShoppingCart" and
then capture those values in the event handler later.
Regards,
Satheesh