Since I am new to working with C# asp.net 2010 within the last few fmonths, I have the following question to ask.
I have been using code like the following in my first *.aspx.cs program:
protected void methodname(object sender, EventArgs e)
{
}
I will haveen using this code since I have been alot of other methods being setup like this. However, can you tell me:
1. When should these type of paramters actually be passed to methods I am writing?
2. Do you know of a reference that would actually explain the generic and specific use of when to use (object sender, EventArgs e)?
Loading
Pravin MorePosted Nov 2, 2011, 12:37 AM
Hi sie,
see,1. Object is the control object that is firing the event.
2.EventArgs will contain necessary event data from which this event has been called.
For example ,suppose we have event of gridviewrowedit
protected Edit (object Sender, GridViewEditEventArgs)
Here sender will be the GridView and e will contain the necessary property from which you can get to know that from which row the edit button has been clicked.
Thanks,
Pravin.