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 4258184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:36:55+00:00 2026-05-21T05:36:55+00:00

I have a base user control (inherited from System.Web.UI.UserControl ) public delegate void MyEventHandler(object

  • 0

I have a base user control (inherited from System.Web.UI.UserControl)

public delegate void MyEventHandler(object sender, MyEventArgs e);
public event MyEventHandler ControlLoaded;

//Fire the event from here
protected override void OnLoad(EventArgs e)
{
  MyEventArgs cmdEventArgs = new MyEventArgs("somearg");
  ControlLoaded(this, cmdEventArgs);
}

I have several controls that are derived from this base user control.

On the host ASPX page, I need to subscribe to the ControlLoaded event.

protected void Page_Load(object sender, EventArgs e)
{
  //subscribe to the event
  //This line DOES NOT WORK as I cannot attach event to a base control - It needs an instance of the user control which I don't have
  BaseUserControl.ControlLoaded += new MyEventHandler(ControlLoaded);
}

private void ControlLoaded(object sender, MyEventArgs e)
{
 // some control has been loaded
}

How do I subscribe to the ControlLoaded event? Thanks

  • 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-21T05:36:55+00:00Added an answer on May 21, 2026 at 5:36 am

    You can’t really subscribe to an instance event without having an instance to subscribe to. You could do this using a static event on BaseUserControl. This, however, is not a good idea; since you would need to be absolutely sure to unsubscribe from that event before the request finishes, in order to prevent a memory leak.

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

Sidebar

Related Questions

I have a custom Grid view object that inherits from the base System.Web.UI.WebControls.GridView. The
I have the following class hierarchy public abstract BaseClass : System.Web.UI.UserControl { public virtual
I have been support a web app that is used by a user base
I have a base UserControl (BaseControl.cs) which has an OK and Cancel buttons on
I have a Qt/C++ project and an old VB6 project. The user base might
I have a base class object array into which I have typecasted many different
In a Visual Studio website, I have created a user control. This control is
I have a base URL : http://my.server.com/folder/directory/sample And a relative one : ../../other/path How
I have a base class with an optional virtual function class Base { virtual
I have a base page, BasePage, that raises an event that displays messages to

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.