I would like to subscribe to the ItemCommand event of a Reorderlist I have on my page. The front end looks like this...
<cc1:ReorderList id="ReorderList1" runat="server" CssClass="Sortables" Width="400" OnItemReorder="ReorderList1_ItemReorder" OnItemCommand="ReorderList1_ItemCommand">
...
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="delete.jpg" CommandName="delete" CssClass="playClip" />
...
</cc1:ReorderList>
in the back-end I have this on Page_Load
ReorderList1.ItemCommand += new EventHandler<AjaxControlToolkit.ReorderListCommandEventArgs>(ReorderList1_ItemCommand);
and this function defined
protected void ReorderList1_ItemCommand(object sender, AjaxControlToolkit.ReorderListCommandEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (e.CommandName == "delete")
{
//do something here that deletes the list item
}
}
}
Despite my best efforts though, I can't seem to get this event to fire off. How do you properly subscribe to this events in a ReorderList control?