ASP.NET Web Controls >> How to implement eventhandlers

by Edward » Fri, 22 Aug 2003 15:37:48 GMT

I've a Web Custom Control in C#. I've override the Render-
method to add 2 listboxes (lst1 and lst2) and 2 buttons
(btn1 and btn2). I also have a method to fill the
listboxes with data. I don't know how I can interact with
events from the listboxes and buttons. For example, what
must I do to handle the SelectedIndexChanged event of lst1
within the control?

Thanks in advance.
Edward

Similar Threads

1. How is "myButton.Click -= new EventHandler(myButton_Click)" implemented? - CSharp/C#

2. To New(EventHandler) or !To New(EventHandler)

I recently installed Resharper to give it a try, and it has made me
wonder about a few things.  The most curious of which concerns event
handlers.  Every single example I've ever seen, every line of real
code I've ever seen, and every demo I've ever seen follows the same
patters.

SomeEvent += new EventHandler(EventHandlerMethod);

...

private void EventHandlerMethod(object sender, EventArgs e)
{
    ...
}


Resharper has been suggesting that the 'new EventHandler()' is
unnecessary code.  When I tell it to do it's thing, it changes the
line of code to

SomeEvent += EventHandlerMethod;

I've since been using the latter form to keep Resharper happy, and
because it looks cleaner.

My questions are, is this acceptable?  Is this going to cause some
kind of problem or strangeness that I'm not aware of?  If there are no
problems with this form, why does Everyone use the new EventHandler
form?


Thanks,

John

3. "must implement" AND "cannot implement" - .Net Framework

4. Newbie Help Request :Class implements an interface that implements

5. Newbie Help Request :Class implements an interface that implements another interface - CSharp/C#

6. Interfaces, Implements and Implements...

Hello,



why is it necessary to implement every procedure of an interface by
assigning it manually with another "implements" to the corresponding
procedure of the class, which actually implements the interface. Isn't the
name of the procedure good enough for assigning it unambiguously? I mean,
it's enough with simply deriving one class from another one?



My first thought was, it has something to do with the case sensitivity,
which would be taken into account at least "behind" the Implements-keyword.
But that's not the case (literally ;-).



I've been doing C# until know, so I apologize in advance, if this is a
stupid question.




Thanks for giving it a thought



Klaus


7. Starting timer in DragOver-Eventhandler - Timer ticks not until DragOver-Eventhandler has finished - what to do? - .Net Framework

8. Starting timer in DragOver-Eventhandler - Timer ticks not until DragOver-Eventhandler has finished - what to do?

I took System.Threading.Timer! Works now.

Roland Mler wrote:
> Hi Ng,
> 
> i have a treeview with drag and drop enabled and i want to expand a 
> treenode when the mouse is 3 seconds over the treenode to expand.
> 
> To do so I wanted to start a timer in the DragOver-Eventhandler and save 
> the current node to expand.
> 
> The problem is: the timer does not start to tick until the 
> DragOver-Eventhandler has finished. How can i change this?
> 
> 
> Thanks for helping!
> Roland