title: Find nested Control inside a user control
body: <p>Hi I have a <strong>panel</strong> that contains a <strong>usercontrol</strong> that contains a <strong>repeater</strong> that can have one or more <strong>checkboxes</strong>.</p>
  
  <p>I want to get status of all check boxes that currently are in the panel. </p>
  
  <p>My current code is </p>
  
  <pre><code>bool isChecked = false;
  
          foreach (Control control in pnlLoanProcess.Controls)
          {
              if (control is BookLoanActions)
              {
                  BookLoanActions uc = (BookLoanActions)control;
  
                  foreach (Control c in uc.Controls)
                  {
  
                      if (c.GetType() == typeof(Repeater))
                      {
                          Repeater rptr = (Repeater)c;
                          foreach (Control c1 in rptr.Controls)
                          {
                              if (c1.GetType() == typeof(CheckBox))
                              {
                                  CheckBox chkBox = (CheckBox)c1;
                                  if (chkBox.Checked)
                                      isChecked = true;
                              }
                          }
                      }
                  }
              }
          }
  </code></pre>
  
  <p>Is there a shorter/better way to do this?</p>