title: Find which input radio button is checked in code behind
body: <p>I have the following ListView that contains Input radio buttons:</p>
  
  <pre><code>&lt;asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource_BGlist"&gt;
          &lt;ItemTemplate&gt; 
              &lt;input id="Radio1" name="BG_name" type="radio" value="&lt;%# Eval("BG_fileName") %  &gt;"/&gt;      
              &lt;asp:Label ID="BG_fileNameLabel" runat="server" Text='&lt;%# Eval("BG_fileName") %&gt;' /&gt;
          &lt;/ItemTemplate&gt;
  
      &lt;/asp:ListView&gt;
      &lt;asp:SqlDataSource ID="SqlDataSource_BGlist" runat="server" ConnectionString="Data Source=tcp:cg26trmnla.database.windows.net,1433;Initial Catalog=cookniche;Integrated Security=False;User ID=PublicSQLcookniche@cg26trmnla;Password=Abounakhle80+;Connect Timeout=30;Encrypt=True" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [BG_fileName] FROM [BackgroundImages]"&gt;&lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>I want to check which radio button is checked from code behind. I'm using the following code but it's obviously not correct. </p>
  
  <pre><code> foreach (ListViewItem itemRow in this.ListView1.Items)
                  {
                      RadioButton radioBtn = new RadioButton();
                      radioBtn = (RadioButton)itemRow.FindControl("Radio1");
                      if (radioBtn.Checked)
                      {
                          //do stuff                    
                      }
                  }
  </code></pre>