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

  • Home
  • SEARCH
  • 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 6932835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:45:22+00:00 2026-05-27T11:45:22+00:00

In the MSDN page lifecycle reference it states that the pre-init is used to

  • 0

In the MSDN page lifecycle reference it states that the pre-init is used to “Create or re-create dynamic controls.”

However, elsewhere on MSDN, an example implies that a dynamic user control should be loaded in Page_Load

Is this a contradiction? Or is pre-init used only for standard aspx controls?

What have I missed 🙂

Edit:
Either way works, however, there is presumably some benefit of one approach over the other.

(WebUserControl1 is a UserControl with a simple label property, SomeProperty)

protected override void OnPreInit(EventArgs e)
{
    base.OnPreInit(e);
    WebUserControl1 wc1 = LoadControl(@"~\WebUserControl1.ascx") as WebUserControl1;
    wc1.SomeProperty = "Hello World";
    Controls.Add(wc1);
}

protected void Page_Load(object sender, EventArgs e)
{
    WebUserControl1 wc1 = LoadControl(@"~\WebUserControl1.ascx") as WebUserControl1;
    wc1.SomeProperty = "Hello World";
    Controls.Add(wc1);
}
  • 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-27T11:45:22+00:00Added an answer on May 27, 2026 at 11:45 am

    The answer is it depends on your custom control. If your user control doesn’t need anything to happen before page_load, then you can go ahead and add your control during page load, if you have code in your user control that executes at an earlier time, then you should add your control at an earlier stage as the MSDN article suggests.

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

Sidebar

Related Questions

From the ASP.Net Page Lifecycle article on MSDN : Although both Init and Load
In the following MSDN page it states the encryption algorithms that are supported by
The T-SQL MSDN page states The timestamp syntax is deprecated. This feature will be
On the page http://msdn.microsoft.com/en-us/library/bb202066.aspx If references something called POLL Driver V2 however this is
When does script added to the page with Page.ClientScript.RegisterStartupScript() actually run? MSDN states "when
I this MSDN Magazine article , the author states (emphasis mine): Note that boxing
This MSDN page mentions that there're nothrow versions of new and delete . nothrow
DependencyProperty.AddOwner MSDN page offers an example with two classes with static members, and the
On this MSDN page it is stated that nested installations (also called concurrent installations)
I read over the msdn page on the -i here. I've never even used

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.