You specify event wirings on server controls using a declarative attribute name/value pair syntax, where the attribute name represents the control’s event name and the value represents the method on the Page that should be called when the event is fired. For example:
<ASP:Classname EventName="EventHandlerMethodName" runat=server />
At run time, Web Forms will dynamically wire the appropriate, type-safe, NGWS frameworks delegate object between the control event adder method and the target page method. (Note that the target method can either be defined declaratively within a <script runat=server></script> block or in a pre-compiled, code-behind file).
For example, the following declarative syntax would automatically wire the OnServerClick event on a button control:
<html> <script runat=server> Sub MyButton_Click (Sender as Object, Evt as EventArgs) ' Do something when someone clicks the button. End Sub </script> <body> <form action="default.aspx" method="post" runat=server> <ASP:button text="Hi" OnServerClick="MyButton_Click" runat=server/> </form> </body> </html>