title: Evaluation of RadioButtonList control using JavaScript - ASP.Net
body: <p>I am developing a website using asp.net and C#.</p>
  
  <p>I am using a RadioButtonList control. The code snippet for RadioButtonList is shown below</p>
  
  <pre><code> &lt;asp:RadioButtonList ID="RLCompareParameter" runat="server" 
              RepeatDirection="Horizontal" meta:resourcekey="rsKey_RLCompareParameter" 
              AutoPostBack="True" 
              onselectedindexchanged="RLCompareParameter_SelectedIndexChanged"&gt;
            &lt;asp:ListItem Selected="True" Value="Forms" meta:resourcekey="rsKey_RLCompareParameterListItemForms" Text="Forms"&gt;&lt;/asp:ListItem&gt;
            &lt;asp:ListItem Value="Segments" meta:resourcekey="rsKey_RLCompareParameterListItemSegments" Text="Segments"&gt;&lt;/asp:ListItem&gt;
            &lt;asp:ListItem Value="Questions" meta:resourcekey="rsKey_RLCompareParameterListItemQuestions" Text="Questions"&gt;&lt;/asp:ListItem&gt;
       &lt;/asp:RadioButtonList&gt;
  </code></pre>
  
  <p>There is a button in the same page. While clicking on that button i want to display an alert message based on the selected radio list item using javascript. Some part of my javascript function is shown below</p>
  
  <pre><code>  var RLCompareParameter = this.document.getElementById("&lt;%= RLCompareParameter.ClientID %&gt;");
           if (RLCompareParameter.SelectedValue == "Forms") {
               if (document.getElementById("&lt;%= lbAvailableForms.ClientID %&gt;").value == "") {
                   alert("Please select a form from Available Evaluation Forms ");
                   return false;
               }
  
  
           } else if (RLCompareParameter.SelectedValue == "Segments") {
               if (document.getElementById("&lt;%= lbAvailableSegments.ClientID %&gt;").value == "") {
                   alert("Please select a segment from the available segments ");
                   return false;
               }
           } else if (RLCompareParameter.SelectedValue == "Questions") {
               if (document.getElementById("&lt;%= lbAvailableQuestions.ClientID %&gt;").value == "") {
                   alert("Please select a Question from the available questions");
                   return false;
  
               } 
           }
  </code></pre>
  
  <p>But the if(RLCompareParameter.SelectedValue == "some value") always false. i think there is no attribute like selected value for RadioButtonList control. I hope someone help me</p>