title: ASP.NET Select RadioButtonList value with JavaScript
body: <p>I've been trying to figure this out for hours, but with now luck.  Was hoping you can help me.  here is my script: </p>
  
  <pre><code>function confirmPurge() {
          var d = confirm("You are about to purge all records, click Ok to proceed");
          if (d) {
              var c = document.getElementByName("yes");
              c.checked = true;
          }
          else {
              var c = document.getElementByName("no");
              c.checked = true;
          }
  </code></pre>
  
  <p>and html is this:</p>
  
  <pre><code>&lt;asp:RadioButtonList ID="rblPurgeRecords" runat="server" 
                      RepeatDirection="Horizontal"&gt;
                      &lt;asp:ListItem onclick="confirmPurge();" name="yes"&gt;Yes&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Selected="True" name="no"&gt;No&lt;/asp:ListItem&gt;
                  &lt;/asp:RadioButtonList&gt;
  </code></pre>
  
  <p>When I try to run it, i get a pop up asking me to click ok or cancel.  If I click ok my code breaks and I get this error: "Microsoft JScript runtime error: 'ScriptManager' is undefined"</p>
  
  <p>Was wondering why is this not working? or is there a better way to programatically set which button in radio list is selected.</p>