Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4112260
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:10:21+00:00 2026-05-20T22:10:21+00:00

I have this case where I’m creating 2 different event handlers placed in a

  • 0

I have this case where I’m creating 2 different event handlers placed in a base class and subscribing to them accordingly from Quotes and Charts classes. Problem I’m having is that the first subscription triggers fine for the first event but any following subscriptions don’t get executed. I have included an example of 2 different handlers, Quotes and Charts, Quotes executes first time with no problems, but Charts does not trigger when data is received.

Base Class:

public abstract class MyBaseClass
{
    protected virtual void RaiseOnQuoteData(string item) { }
    protected virtual void RaiseOnChartData(string item) { }

    void OnDataReceived(object sender, DataEventArgs e)
    {
        if (e.Item == "QUOTE")
            RaiseOnQuoteData(e.Item);
        else if (e.Item == "CHART")
            RaiseOnChartData(e.Item);
    }
}

Quote and Chart Classes:

public class Quote : MyBaseClass
{
    public event EventHandler<DataEventArgs<quoteRecord>> OnQuoteData;

    protected override void RaiseOnQuoteData(string item)
    {
        OnQuoteData.Raise<DataEventArgs<quoteRecord>>(this, new DataEventArgs<quoteRecord>(item));
    }
}

public class Chart : MyBaseClass
{
    public event EventHandler<DataEventArgs<chartRecord>> OnChartData;

    protected override void RaiseOnChartData(string item)
    {
        OnChartData.Raise<DataEventArgs<chartRecord>>(this, new DataEventArgs<chartRecord>(item));
    }
}

Subscription:

public class QuoteSubscription
{
    public static void SubscribetoQuoteData()
    {
        Quote Q = new Quote();
        Q.OnQuoteData += new EventHandler<DataEventArgs<quoteRecord>>(q_OnQuoteData);
    }

    static void q_OnQuoteData()
    { 
        //Executes fine
    }
}

public class ChartSubscription
{
    public static void SubscribetoChartData()
    {
        Chart C = new Chart();
        C.OnChartData += new EventHandler<DataEventArgs<chartRecord>>(q_OnChartData);
    }

    static void q_OnChartData()
    {
        //Does not execute
    }
}

This is implemented in ASP.NET 4.0, Is there any chance that instantiating the derived classes could be the problem since both classes do share the same base class? Any help pointing to the cause would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:10:22+00:00Added an answer on May 20, 2026 at 10:10 pm

    What is there in Raise? This must be an extension method, since EventHandler per se doesn’t define such a method. Therefore, you can put a breakpoint inside and see, what’s going on. (And you could perhaps put a breakpoint inside RaiseOnChartData as well.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this case class define: class Protocol(protocol:String) object Protocol { def apply(protocol:String) :Protocol
Imagine this case where I have an object that I need to check a
i have this block of xslt if-else case and was wondering if there's a
Suppose that I have a Java program within an IDE (Eclipse in this case).
Scenario: I have a document I created using LaTeX (my resume in this case),
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
I have some code that looks like this: someFunc(value) { switch(value){ case 1: case
I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth=200
I have this HTML <div id=navContainer> <ul> <li class=selected><a href=#>Home</a></li> <li><a href=#>Services</a></li> </ul> </div>
I have this select Case SQL statement which compute the totalvolume of a given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.