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

Discussion in 'ASP .Net' started by Karch, Mar 2, 2007.

  1. Karch

    Karch Guest

    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!
     
    Karch, Mar 2, 2007
    #1
    1. Advertisements

  2. Karch

    sloan Guest

    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
     
    sloan, Mar 2, 2007
    #2
    1. Advertisements

  3. Karch

    sloan Guest

    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
    }
    }
     
    sloan, Mar 2, 2007
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.