Thursday, February 19, 2009

Event Handler Method !!

Que : What is Event Handler Method ?

Ans : An event handler method is a special type of Method in an ASP.NET web page that defines the actions that will occur when a particular event occurs.

Example : Take an examle of event handler method, first take an event : click event. We saw that if you are int the Design view for a wev form and you double click on a Buttion control, Visual Web Developer or Visual Studio will automatically generate an event handler Method called Buttion_Click.Basically an empty method is generated and Visual Web Developer or Visual Studio lets you put what ever code you want into that event handler.

Que : What is the meaning the event driven model ?


Ans : ASP.NET uses an event driven programming model.This means that in order for code to run, an event must occur that triggers or tells ASP.NET to run an event handler Method.

Que : What is the naming convention of Event Handler Method ?

Ans : Notice the naming convention that Visual Web Developer when it generates the event handler Method. The first part of the name is the ID for the server control: Button1. The second part of the name an underscore appended with the event type: Click. This convention helps you as the developer know when that Method will be called by ASP.NET. In this case, the click event fires when a user single clicks on the Button control.

No comments: