title: Reading values of all text boxes of a screen
body: <p>In my application I have a master page, a web page that uses the master page, a panel and within the panel control I have several text box controls and a button to trigger the postback. I have written the following code to read the values entered in the text boxes. However, I am getting 0 count for the text box. Can you please let me know what is wrong in the code:</p>
  
  <pre><code>    // Function to read the entries of the text boxes.
      public ArrayList GetAllTextBoxes(Control parent)
      {
          ArrayList myActions = new ArrayList();
          foreach (Control c in parent.Controls)
          {
              // Check and see if it's a textbox  
              if ((c.GetType() == typeof(TextBox)))
              {
                  // Since its a textbox read the text     
                  myActions.Add(((TextBox)(c)).Text);
              }
              // Now we need to call itself (recursion) 
              if (c.HasControls())
              {
                  GetAllTextBoxes(c);
              }
          }
          return myActions;
      }
  
      and this function is called like this on the click button function:
  
      protected void Button1_Click(object sender, EventArgs e)
      {
          ArrayList allActions = new ArrayList();
          ManageDef setStatus = new ManageDef();
          allActions = setStatus.GetAllTextBoxes(this);
      }
  </code></pre>