Event handler is a subroutine that executes code for a given event.
ASP. NET-Event handle
Take a look at the following code:
<%lbl1. Text= "The date and Time is" & Now ()%>
When will the above code be executed? The answer is: "I do not know ..." This is the Web page teaching www.webjx.com collection or original content, reproduced please indicate the source!
Page_Load eventsThe Page_Load event is one of the many events that are understood by ASP. The Page_Load event is triggered when the page loads, and ASP. NET automatically calls the subroutine Page_Load and executes the code in it:
<script runat= "Server" >sub page_loadlbl1.text= "The date and Time is" & Now () End sub</script>
Note: The Page_Load event does not contain object references or event arguments!
Page.IsPostBack PropertyThe Page_Load subroutine runs every time the page loads. You can use the Page.IsPostBack property if you only want code in the Page_Load subroutine to be executed the first time the page is loaded. If the Page.IsPostBack property is False, the page is loaded for the first time, and if true, the page is passed back to the server (for example, by clicking a button on the form):
<script runat= "Server" >sub page_loadif not Page.IsPostBack then lbl1. Text= "The date and Time is" & Now () End IfEnd SubSub Submit (s as Object, E as EventArgs) lbl2. text= "Hello world!" End sub</script>
The above example creates "the date and time is ..." only when the page is first loaded. The message. When the user clicks the Submit button, the Submit subroutine creates a "Hello world!" in the second label, but the date and time in the first label do not change.
Reprinted from: http://www.aspnetjia.com/Cont-1145.html
Asp. NET Getting Started Tutorial: event handlers