Expalin (Object sender,EventArgs e)

Posted by Kannan1986 under ASP.NET on 2/9/2010 | Views : 27066 | Status : [Member] | Replies : 3
Expalin (Object sender,EventArgs e)




Responses

Posted by: Raja on: 2/9/2010 [Member] Starter

Up
0
Down
Object is the control object that is firing the event.

EventArgs will contain necessary event data from which this event has been called.

For example
protected Edit (object Sender, GridViewEditEventArgs e)

Here sender will be the GridView
e will contain the necessary property from which you can get to know that from which row the edit button has been clicked.

Thank you.

Regards,
Raja, USA

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/10/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
It is just a signature which is defined in the delegate

System.EventHandler

It is general to many events.

You can define a new delegate for you if you want :
public delegate void CustomEventHandler(object sender, CustomEventArgs e);

:)

www.abhisheksur.com

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/11/2010 [Member] Bronze

Up
0
Down
We can do the event related functionalities according to the object fired the even thrugh these.

Best example I can provide is rowdatabound. below is an example.

Protected Sub grdvw1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) 



If e.Row.RowState = DataControlRowState.Edit Then
e.Row.Cells(2).BackColor = Color.LightSalmon


End If













Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response