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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:57:51+00:00 2026-06-17T08:57:51+00:00

I have a user control (Navigation) nested within another user control (Header) that is

  • 0

I have a user control (Navigation) nested within another user control (Header) that is dynamically loaded from a Control class (Standard).

The user controls, Navigation and Header have AutoEventWireup = false.

The control class Standard calls loads the Header user control from a configuration item.

private void layoutAndRender(HtmlTextWriter output, string UserControlKey, NameValueCollection UserControlsConfiguration)
{
    if(UserControlsConfiguration[UserControlKey] != null && UserControlsConfiguration[UserControlKey].ToString() != "")
    {
        string suc = System.Web.HttpContext.Current.Request.ApplicationPath + UserControlsConfiguration[UserControlKey].ToString();
        UserControl ucToRender = (UserControl)this.Page.LoadControl(suc);
        ucToRender.RenderControl(output);
    }
}

My problem is that I want to initialize an object in the Navigation user control that can accept Page.Request and Page.Response, but events don’t seem to be firing in the Navigation code behind.

The code I’m using to initialize my object is:

this.browser = new Browser(this.Request, this.Response);

I tried doing this during the Navigation constructor but this.Request and this.Response are not set at that time.

I tried using the statement in a void Page_Load(object sender, System.EventArgs e) method, but this doesn’t seem to be firing, even if I have this.Load += new System.EventHandler(this.Page_Load); in the Navigation constructor.

I’ve also tried similar statements for Page_Init and Page_PreRender, but none of these seem to be firing.

Is it that a control loaded with LoadControl does not fire Load or Init events, if loaded the way I have loaded them, and the same goes for any user controls that it may include?

  • 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-06-17T08:57:52+00:00Added an answer on June 17, 2026 at 8:57 am

    Unfortunately, this is legacy code, and not always done the right way.

    In particularly, because the user control is loaded and rendered manually, it probably skips most of the event model that I wanted to take advantage of. Ideally, it should have done an AddControl() to the page, rather than rendering the control to a HtmlTextWriter.

    My work around is to override the RenderControl method, and initialize the browser property before passing RenderControl up the chain.

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

Sidebar

Related Questions

I have an User Control that host another controls like panel, chart controls. Right
I have a user control named Navigation that has a property that holds navigation
within my current project file I have a user control that has a storyboard
I have this User Control XAML: <Window x:Class=MyProj.Dialog xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:shell=http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell mc:Ignorable=d>
I have a user control that is being integrated to the page on run
I have a user control with a div like this: <div runat=server id=pnlShippingMethods class=checkoutstep>
I have a data navigation user control in Silverlight which opens a child window
I have a user control that generates a series of arrow buttons. I want
I have two user controls on the same page. One contains a ListView that
I have user control in my MVC2 app placed in the Content folder (it's

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.