| |||||||
Repeater.ItemCommand EventSystem.Web.UI.WebControls Namespace Repeater Class Occurs when a button within a Repeater control is clicked. [ VB ] Public Event ItemCommand As RepeaterCommandEventHandler [ C# ] public event RepeaterCommandEventHandler ItemCommand; [ C++ ] public: __event RepeaterCommandEventHandler* ItemCommand; In [ JScript ], you can handle the events defined by a class, but you cannot define your own. RemarksThe ItemCommand event is raised whenever any button associated with an item in the Repeater 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 Repeater control. Event DataThe method assigned to handle the event is passed a RepeaterCommandEventArgs object containing data related to the ItemCommand event. The following RepeaterCommandEventArgs properties provide information specific to this event.
ExampleThe following example illustrates a way to handle the ItemCommand event of a Repeater. Information about the selected item is displayed whenever any of the LinkButton controls within the Repeater is clicked. The below snippet shows how to attach a handler for the event. <asp:repeater id = "myRepeater" runat = "server" onItemCommand = "showItem" ... > The below shows how the handler method is defined. void showItem ( Object src, RepeaterCommandEventArgs e ) {
items.Text = e.Item.ItemType.ToString ( ) + " " +
e.Item.ItemIndex.ToString ( ) + ", " +
( ( LinkButton ) e.CommandSource ).Text + "<br>";
}
See Also |
| ||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme