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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:53:07+00:00 2026-05-14T05:53:07+00:00

So all I want to do is simply find a user control I load

  • 0

So all I want to do is simply find a user control I load based on a drop down selection. I have the user control added but now I’m trying to find the control so I can access a couple properties off of it and I can’t find the control for the life of me. I’m actually doing all of this in the master page and there is no code in the default.aspx page itself. Any help would be appreciated.

MasterPage.aspx

<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager runat="server">
        </asp:ScriptManager>
    </div>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false"
        OnLoad="UpdatePanel2_Load">
        <ContentTemplate>
            <div class="toolbar">
                <div class="section">
                    <asp:DropDownList ID="ddlDesiredPage" runat="server" AutoPostBack="True" EnableViewState="True"
                        OnSelectedIndexChanged="goToSelectedPage">

                    </asp:DropDownList>
                    &nbsp;
                    <asp:DropDownList ID="ddlDesiredPageSP" runat="server" AutoPostBack="True" EnableViewState="True" OnSelectedIndexChanged="goToSelectedPage">

                    </asp:DropDownList>
                    <br />
                    <span class="toolbarText">Select a Page to Edit</span>
                </div>
                <div class="options">
                    <div class="toolbarButton">
                        <asp:LinkButton ID="lnkSave" CssClass="modal" runat="server" OnClick="lnkSave_Click"><span class="icon" id="saveIcon" title="Save"></span>Save</asp:LinkButton>
                    </div>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
        </Triggers>
    </asp:UpdatePanel>
<div id="contentContainer">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnLoad="UpdatePanel1_Load" UpdateMode="Conditional"
                    ChildrenAsTriggers="False">
                    <ContentTemplate>
                        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                        </asp:ContentPlaceHolder>
                    </ContentTemplate>
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="lnkHome" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="rdoTemplate" EventName="SelectedIndexChanged" />
                    </Triggers>
                </asp:UpdatePanel>
            </div>

MasterPage.cs

protected void goToSelectedPage(object sender, System.EventArgs e)
        {
temp1 ct = this.Page.Master.LoadControl("temp1.ascx") as temp1;
                ct.ID = "TestMe";
                this.UpdatePanel1.ContentTemplateContainer.Controls.Add(ct);
}
//This is where I CANNOT SEEM TO FIND THE CONTROL ////////////////////////////////////////
protected void lnkSave_Click(object sender, System.EventArgs e)
        {
            UpdatePanel teest = this.FindControl("UpdatePanel1") as UpdatePanel;
            Control test2 = teest.ContentTemplateContainer.FindControl("ctl09") as Control;
            temp1 test3 = test2.FindControl("TestMe") as temp1;

            string maybe = test3.Col1TopTitle;
        }

Here I don’t understand what it’s telling me. for “par” I get “ctl09” and I have no idea how I am supposed to find this control.
temp1.ascx.cs

 protected void Page_Load(object sender, EventArgs e)
        {
string ppp = this.ID;
                string par = this.Parent.ID;
}
  • 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-14T05:53:07+00:00Added an answer on May 14, 2026 at 5:53 am

    Unless you’re calling goToSelectedPage in your page’s Init handler, or else it’s part of a page setup routine that is executed the exact same way on every page load, then your dynamically created control ct does not exist on the postback.

    Remember that every time you post, you are getting a new instance of a Page, with brand new instances of all the controls on it. If you’re not recreating and adding your usercontrol the same way every time, it simply won’t be there.

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

Sidebar

Related Questions

The subject says it all... I simply want Xcode to make a beep or
I have a very simple jQuery script.. all I want it to do is
I have created a very simple sharepoint timer job. All i want it to
So all I simply want to do is make a Ruby program that reads
I have a little problem with the creation of a user control. Though I
All i want to do is display my joined tables user and products to
I am using running a simple find all and paginating with willpaginate, but I'd
I have a problem with jquery not loaded in an asp user control. I
I've looked all over and have been unable to find a solution to my
I have tried in vain to find a solution for this issue, but 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.