title: ASP.Net c# Which radio button in a given GroupName is selected?
body: <p>I have 30 individual RadioButtons. I can not use a RadioButtonList. There are 3 groups of buttons. Each group has a unique GroupName. Everything works properly in the web browser. How can i tell on a post back which button is selected within each of the given GroupsNames?</p>
  
  <p><strong>EDIT:</strong> the function i used</p>
  
  <pre><code>private string getRadioValue(ControlCollection clts, string groupName)
  {
      string ret = "";
      foreach (Control ctl in clts)
      {
          if (ctl.Controls.Count != 0)
          {
              if (ret == "")
                  ret = getRadioValue(ctl.Controls, groupName);
          }
  
          if (ctl.ToString() == "System.Web.UI.WebControls.RadioButton")
          {
              RadioButton rb = (RadioButton)ctl;
              if (rb.GroupName == groupName &amp;&amp; rb.Checked == true)
                  ret = rb.Attributes["Value"];
          }
      }
      return ret;
  }
  </code></pre>