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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:04:40+00:00 2026-05-12T17:04:40+00:00

I have a masterpage with an update panel: <asp:UpdatePanel ID=UpdatePanel runat=server ChildrenAsTriggers=true EnableViewState=False UpdateMode=Conditional>

  • 0

I have a masterpage with an update panel:

<asp:UpdatePanel ID="UpdatePanel" runat="server" ChildrenAsTriggers="true" EnableViewState="False"
                UpdateMode="Conditional">
                <ContentTemplate>
                    <div id="mainContent">
                        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                        </asp:ContentPlaceHolder>
                    </div>
                </ContentTemplate>
                <Triggers>
              </Triggers>
            </asp:UpdatePanel>

Then I have Default.aspx page which uses the masterpage file:

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<asp:PlaceHolder ID="plhCurrentItem" runat="server"></asp:PlaceHolder>
</asp:Content>

I programmatically load usercontrols into the placeholder with id plhCurrentItem.

The problem is when I click a button in the usercontrol, no event fires. The usercontrol just disappears and the updatepanel is left blank.

What am I doing wrong?


Update

Code used to add usercontrols. The LoadControls method is called from the Page_load event.

 Control ctlCurrentItem = null;

public string currentControl
{
    get { return ((string)Session["currentControl"]); }
    set { Session["currentControl"] = value; }
}



public void LoadControls()
{
    switch (currentControl)
    {
        case "Home":
            ctlCurrentItem = Page.LoadControl("~/pages/Home.ascx");
            ctlCurrentItem.ID = "Home";
            break;
        case "Resume":
            ctlCurrentItem = Page.LoadControl("~/pages/Resume.ascx");
            ctlCurrentItem.ID = "Resume";
            break;
        case "Projects":
            ctlCurrentItem = Page.LoadControl("~/pages/Projects.ascx");
            ctlCurrentItem.ID = "Projects";
            break;
        case "Contact":
            ctlCurrentItem = Page.LoadControl("~/pages/Contact.ascx");
            ctlCurrentItem.ID = "Contact";
            break;
        default:
            return;

    }
    plhCurrentItem.Controls.Clear();
    plhCurrentItem.Controls.Add(ctlCurrentItem);


}
  • 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-12T17:04:40+00:00Added an answer on May 12, 2026 at 5:04 pm

    Put LoadControls call in the OnPreInt event from the page life-cycle:

    Use this event for the following:

    • Check the IsPostBack property to determine whether this is the first time the page is being processed.
    • Create or re-create dynamic controls.
    • Set a master page dynamically.
    • Set the Theme property dynamically.
    • Read or set profile property values.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Update panel in Master page: <asp:ScriptManager id=CartScript runat=server></asp:ScriptManager> <asp:UpdatePanel id=CartBox runat=server updateMode=Conditional>
I have a page setup like so: <ajax:UpdatePanel id=UpdatePanel1 runat=server UpdateMode=Conditional> <ContentTemplate> <asp:TextBox id=TextBox1
<ajaxtoolkit:AccordionPane ID=accordianPaneAroundTheCheckbox runat=server> <Content> <asp:UpdatePanel ID=updatePanelAroundTheCheckbox runat=server > <ContentTemplate> <div> <asp:CheckBox ID=chkFoo AutoPostBack=true runat=server
I have a Masterpage like that : ... <head id=Head1 runat=server> <asp:ContentPlaceHolder ID=HeadContent runat=server
I have a Content Page with drop down lists within an update panel: <asp:UpdatePanel
I have a ASP updatepanel, within that panel I have some controls which got
I have an ASP.NET site that uses JQuery and ASP.NET UpdatePanel and ScriptManager. On
TGIF, I have a website I'm developing which is using ASP.NET masterpage/sitemap/content pages setup.
I have Async File Upload <cc1:AsyncFileUpload ID=AsyncFileUpload2 EnableViewState=true Width=400 UploaderStyle=Modern OnClientUploadComplete=showDiv OnUploadedComplete=AsyncFileUpload1_UploadedComplete ClientIDMode=AutoID runat=server
I have an updatepanel on my masterpage. Within the contentplace holder I have my

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.