title: How can I get selected values from radio button list and check box list?
body: <p>I'm trying to get selected values from radio button list and check box list at asp.net, C#.
  Here's my code.</p>
  
  <h2>aspx.cs</h2>
  
  <pre><code>protected void Next_Click(object sender, EventArgs e)
      {
          var retList = new List&lt;string&gt;();
  
          foreach (RepeaterItem item in questionRepeater.Items)
          {
              // Checking the item is a data item
              if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
              {
  
                  var rdbList = item.FindControl("RadioButtonList1") as RadioButtonList;
                  // Get the selected value
                  if (rdbList != null)
                  {
                      retList.Add(rdbList.SelectedValue);
                  }
              }
          }
  
  
          foreach (RepeaterItem item in questionRepeater.Items)
          {
              // Checking the item is a data item
              if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
              {
                  var rdbList = item.FindControl("CheckBoxList1") as CheckBoxList;
                  // Get the selected value
                  if (rdbList != null)
                  {
                      retList.Add(rdbList.SelectedValue);
                  }
              }
  
  
  
          }
      }
  </code></pre>
  
  <h2>aspx</h2>
  
  <pre><code>&lt;asp:Repeater ID="questionRepeater" runat="server"&gt;
  &lt;ItemTemplate&gt;
       &lt;div runat="server" visible='&lt;%# (Eval("QUESTION_TYPE").ToString() == 
       "0") %&gt;'&gt; 
        &lt;table style="width:100%; table-layout: fixed;"&gt;  
                  &lt;asp:RadioButtonList id="RadioButtonList1" CellSpacing="50" 
        TextAlign="Left" runat="server" 
        DataSource='&lt;%#GetChild(Container.DataItem,"ChoicesRelate") %&gt;' 
        DataTextField="CHOICES_CONTENT" DataValueField="CHOICES_NO"&gt;
                  &lt;/asp:RadioButtonList&gt;
             &lt;/table&gt; 
       &lt;/div&gt;
  
       &lt;div runat="server" visible='&lt;%# (Eval("QUESTION_TYPE").ToString() == 
       "1") %&gt;'&gt;
        &lt;table style="width:100%; table-layout: fixed;"&gt;
       &lt;asp:CheckBoxList id="CheckBoxList1" CellSpacing="50" TextAlign="Left" 
     runat="server"DataSource='&lt;%#GetChild(Container.DataItem,"ChoicesRelate") 
     %&gt;' DataTextField="CHOICES_CONTENT" DataValueField="CHOICES_NO"&gt;
                  &lt;/asp:CheckBoxList&gt;  
            &lt;/table&gt;
       &lt;/div&gt;      
      &lt;br /&gt;
  &lt;/ItemTemplate&gt; 
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>I refered below Answser.
  <a href="https://stackoverflow.com/questions/42167306/get-radio-button-list-responses-with-data-source-asp-net">Get radio button list responses with data source asp.net</a></p>
  
  <h1>problem</h1>
  
  <p>I can't get all selected values(just one value) from check box list, while I can get all from radio button list..
  What should I do?
  Please help me..</p>