Translate

Sunday, May 1, 2011

object sender, EventArgs e

The event handlers for most .net generated events meet the definition of the kind


protected void EventName(object sender, EventArgs e)
 {
          

}


sender is a reference to the object that raised the event

On a button click if you check the value of sender.GetType() , you would see something like
Web.UI.WebControls.Button

e contains the parameters passed by the event

For instance if you are consuming a user created custom event, you could have parameters like
e.pageNumber, e.pageSize etc.

3 comments:

Comments will appear once they have been approved by the moderator