title: How to check which radio button is selected if they're all runat server?
body: <p>I have some code where I need to check radio buttons, and I know how to do it all client side. Here's the markup:</p>
  
  <pre><code>&lt;input type="radio" id="rbInternalUser" name="radioUserType" value="Internal" onclick="setUserType()"/&gt;
  &lt;label for="&lt;%=rbInternalUser.ClientID%&gt;"&gt;Internal User&lt;/label&gt;&lt;br /&gt;
  &lt;input type="radio" id="rbExternalUser" name="radioUserType" value="External" onclick="setUserType()"/&gt;
  &lt;label for="&lt;%=rbExternalUser.ClientID%&gt;"&gt;External User&lt;/label&gt;&lt;br /&gt;
  </code></pre>
  
  <p>And the javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function setUserType() {
          var userType = $("input[name=radioUserType]:checked").val();
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>But I need these controls set to <code>runat=server</code> because I'm doing some code behind stuff as well:</p>
  
  <pre><code>&lt;input type="radio" id="rbInternalUser" name="radioUserType" value="Internal" onclick="setUserType()" runat="server" /&gt;
  &lt;label for="&lt;%=rbInternalUser.ClientID%&gt;"&gt;Internal User&lt;/label&gt;&lt;br /&gt;
  &lt;input type="radio" id="rbExternalUser" name="radioUserType" value="External" onclick="setUserType()" runat="server" /&gt;
  &lt;label for="&lt;%=rbExternalUser.ClientID%&gt;"&gt;External User&lt;/label&gt;&lt;br /&gt;
  </code></pre>
  
  <p>In that case, how do I find out which button is selected? It doesn't seem like the usual <code>$("#&lt;%=myControl.ClientID%&gt;")</code> will work here. I've tried a few things, and this seems close:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function setUserType() {
          var radioUserType = $("#&lt;%=rbInternalUser.ClientID%&gt;").prop("name");
          var userType = $("input[name=" + radioUserType + "]:checked").val();
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><code>radioUserType</code> is getting the client ID, but then the next line fails, saying, "unrecognized expression: input[name=ctl00$body$EditUser1$radioUserType]:checked".</p>
  
  <p>What do I need to put in place of <code>radioUserType</code> to make this work? Is this possible? How can you get the name of the radio button group and then check which button from the group is selected?</p>