For easy reference, here’s how to create an event in a class that listeners can react to:
class DeleteSubOrderEventArgs : EventArgs { public int SubOrderId; public DeleteSubOrderEventArgs(int subOrderId) { SubOrderId = subOrderId; } } class Foobar { public delegate void DeleteEventDelegate(object sender, DeleteSubOrderEventArgs e); public event DeleteEventDelegate DeleteSubOrderClick; protected void DeleteButton_Click(object sender, ImageClickEventArgs e) { // Signal to listeners if (DeleteSubOrderClick != null) { DeleteSubOrderClick(this, new DeleteSubOrderEventArgs(SubOrder.SubOrderId)); } } }