Syntax
-
public delegate void ActionClick();
public event ActionClick OnResetClick;
I haven't found any disadvantages in this approach but there are a few things which make this a little problematic.
- You need to add an event handler for each and every event. If you do
not add the event handlers in the OnInit event of the page, you
might face some problems that on page post back, you will lose the
event assignment (as ASP.NET is stateless, which is not the case
with Windows controls).
- In this approach, you need to respect the page life cycle events.
Some times when you are working on the Designer, there might be a
case when the event handler gets lost without your notice.
- Even if you have not added the event handler, you will not get any
errors or warnings. If you have multiple pages for performing the
same action, there is no guarantee that all the method names will be
same; the developer can choose their own method names, which reduces
the maintainability of the code.