Event not being raised (how to get list of delegates)

K

Karch

I have an event that is not being raised on postback from client script. It
DOES get raised during a "normal" postback. The event is wired up in the
Page Init. I have traced through and my event target looks correct in both
scenarios.

How can I determine the current list of delegates to see where I am losing
my event when posting back from client script? Or, is there a better way?

Thanks!
 
S

sloan

With C# you have this ability:
private event EventHandler m_myEvent;
public event EventHandler MyEvent
{
add{
m_myEvent += value;
}
remove{
m_myEvent -= value;
}
}




with vb.net, you don't get this. ( why? who knows? microsoft doesn't
allow the add or remove event. ... which is a serious deficiency in my book)

See
http://www.developer.com/net/vb/article.php/2172721
 
S

sloan

PS


add
{
m_myEvent += value;
if (m_myEvent == null || m_myEvent .GetInvocationList().Length > 0)
{
// there is a interested party
} }
remove
{
m_myEvent -= value;
//stop the listener if no handler is listed
if (m_handler == null || m_handler.GetInvocationList().Length <= 0)
{
// there is still a interested party
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top