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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:45:12+00:00 2026-05-24T00:45:12+00:00

Im aware this may be a slightly odd question, but given a Page class

  • 0

Im aware this may be a slightly odd question, but given a Page class that looks like this:

    public class abc:Control
    {
      public abc()
      {
        this.Init+=new EventHandler(foo);
        this.Load+=new EventHandler(foo);
      }    

      void foo(object sender, eventargs e)
      {
        //determine whether or not this.Init has already fired.
      }
    }

I know I could do this by setting a global boolean ‘hasinitfired’, but I was wondering if this was not necessary or if something as part of the .net library already existed.

  • 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-24T00:45:12+00:00Added an answer on May 24, 2026 at 12:45 am

    Why do you need to know init is fired or not. Init always gets fired during postback or callback. Go through ASP.net page lifecycle, and you will know what all events fired after init and what all before. If you intend to use same handler for different events, yes make a class variable to identify the current event. I recommend attach different handler, and call another method with different param value.

    like,

     public class abc:Control
        {
          public abc()
          {
            this.Init+=new EventHandler(foo1);
            this.Load+=new EventHandler(foo2);
          }    
    
          void foo1(object sender, eventargs e)
          {
            foo('init');
          }
          void foo2(object sender, eventargs e)
          {
            foo('load');
          }
          void foo(string from)
          {
             // do something
          }
    
        }
    

    This will give cleaner solution and flexibility to add functionality.

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

Sidebar

Related Questions

I'm aware that this question may have been asked before, but I still haven't
I aware that this will be a less programming question, but still... How can
This may seem like a really stupid question, but what is the cost of
I'm aware that you can do this: public ActionResult DoSomething([Bind(Exclude = CreationDate)] Item item)
In this question , I was made aware of glob()'s GLOB_BRACE option that allows
I'm aware that MD5 has had some collisions but this is more of a
In the answer to this question ovanes states: Please be aware that boost::lexical_cast is
This may seem like a dumb idea, but is there anyway to serve a
First off, I'm aware that there are many questions related to this, but none
This may be an unusual question, but are there any resources people have come

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.