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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:24:54+00:00 2026-05-23T16:24:54+00:00

I have a user control (Control1) which has a placeholder that may contain several

  • 0

I have a user control (Control1) which has a placeholder that may contain several additional user controls (of the same type – see below) which are added dynamically. How do I navigate the user control hierarchy to find the values of the nested sets of controls when the button located in Control 1 is clicked?

Control 1:

<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="Control1.ascx.cs" Inherits="Control1" %>
<%@ Reference Control="Control2.ascx" %>

<div id="div1">
    <div id="divPh"><asp:PlaceHolder ID="phControls" runat="server" /></div>
<div id="divContinue"><asp:Button ID="btnContinue" Text="Continue" OnClick="submit_Click" runat="server" /></div>
</div>

Code behind for Control1.aspx:

protected void submit_Click(object sender, EventArgs e)
{
  // iterate through list of divControl2 controls and find out which radio button is selected
  // for example, there may be 3 divControl2's which are added to the placeHolder on Control1, rdoBth1 might be selected on 2 of the controls
  // and rdoBtn2 might be selected on 1 - how do I navigate this control structure?
}

Control 2 (Several of these may be added to the placeHolder on Control1):

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Control2.ascx.cs"     Inherits="Control2" %>
  <div id="divControl2">
      <p><strong><asp:RadioButton ID="rdoBtn1" GroupName="Group1" Checked="true" runat="server" /> Check this</strong></p>
      <p><strong><asp:RadioButton ID="rdoBtn2" GroupName="Group1" Checked="false" runat="server" /> No, check this one</strong></p>
  </div>
  • 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-23T16:24:55+00:00Added an answer on May 23, 2026 at 4:24 pm

    Check below code and let me know if you have any queries.

    protected void submit_Click(object sender, EventArgs e)
        {
            for (int count = 0; count < phControls.Controls.Count; count++)
            {
                UserControl uc = (UserControl)(phControls.Controls[count]);
                if (uc != null)
                {
                    RadioButton rdoBtn1 = new RadioButton();
                    RadioButton rdoBtn2 = new RadioButton();
                    rdoBtn1 = (RadioButton)(uc.FindControl("rdoBtn1"));
                    rdoBtn2 = (RadioButton)(uc.FindControl("rdoBtn2"));
                    if (rdoBtn1.Checked == true)
                    {
                        Response.Write("1st checked ");  
                    }
                    else if (rdoBtn2.Checked == true)
                    {
                        Response.Write("2nd checked"); 
                    }
    
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control which has several radiobuttons and buttons... I have code
I have an ASP.NET user control that contains a textbox which has an AJAX
I have a user control which has a textbox on it, now this usercontrol
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
I have a user control - say ControlBase. It has SomeItems property, which is
I have a user control which has a ComboBox and a SelectedIndexChanged event handler.
I have 3rd party user control (a captcha control), which has a captcha image,
I have a custom user control which has some textboxes and some buttons. In
I have a user control which has a Canvas of height 100 and width
I have a user control which implements INotifyPropertyChanged and has a property SelectedTopicDescription and

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.