title: ASP.NET MVC How to Pass radiobutton selected value from view to controller
body: <p>I have a dynamically generated set of radio buttons. I just want to get the selected value across to my controller. I tried few things but it does not work. I can only get hidden field values set by the form for a different purpose. 
  These do not work – they return nothing:</p>
  
  <pre><code>var YourRadioButton2 = Request.Form["wc"];
  string selectedTechnology = form["wc"];
  </code></pre>
  
  <p>Is there a way I can get the selected radio buttons across to the controller. These radiobutton values are dynamically generated.</p>
  
  <p>the View</p>
  
  <pre><code>&lt;%--wired choices--%&gt;
           &lt;tr &gt; Wired Choices &lt;/tr&gt;
          &lt;% for (var i = 0; i &lt; subform.wiredchoices.Count; i++) %&gt;
          &lt;%{ %&gt; 
              &lt;tr&gt;  
  
                  &lt;td&gt; &lt;input type="radio" name="wc" value="&lt;%:    subform.wiredchoices.ElementAt(i).WiredChoiceItem %&gt;" &gt; &lt;/td&gt;
                  &lt;td&gt;&lt;%:    subform.wiredchoices.ElementAt(i).WiredChoiceItem %&gt; &lt;/td&gt;
  </code></pre>
  
  <p>The controller</p>
  
  <pre><code>if (rcpt.Form.Is("VoIP"))
              {
                   Response.Write("&lt;br /&gt;" + "wc " + wc);
  
                   List&lt;String&gt; listValues = new List&lt;String&gt;();
                   foreach (string key in Request.Form.AllKeys)
                   {                    
                           listValues.Add(Request.Form[key]);
                           Response.Write("&lt;br /&gt;" + "first values  " + Request.Form[key]);
                   }
  
                   // Loop through every checkbox
                   foreach (var key2 in form.AllKeys)
                   {
                               Response.Write("&lt;br /&gt;" + "second values  " + key2);
                   }
  
  
                  //See Radiobutton selections
                  var YourRadioButton = Request.Form["wc"];
                  Response.Write("&lt;br /&gt;" + "YourRadioButton " + YourRadioButton);
                  string selectedTechnology = form["wc"];
                  Response.Write("&lt;br /&gt;" + "YourRadioButton " + selectedTechnology);
  
                  var YourRadioButton2 = Request.Form["wlc"];
                  Response.Write("&lt;br /&gt;" + "YourRadioButton " + YourRadioButton2);
                  string selectedTechnology2 = form["wlc"];
                  Response.Write("&lt;br /&gt;" + "YourRadioButton " + selectedTechnology2);
  
                  Response.Write("&lt;br /&gt;" + "VoIP Hire ");
                  String wiredChoice = "test"; //assign value from radio button here
                  String wiredLessChoice = "test"; //assign value from radio button here
  
                  // Stor e submitting page to return to
                  ViewData["ReturnUrl"] = fields.formType;
  
  
  
                  &lt;/tr&gt;
              &lt;%} %&gt;
  </code></pre>