title: How to Populate Yes/No Checkbox List Using Values from GridView?
body: <p>I have a checkbox list in a grid view edit popup with yes and no choices. I am attempting to populate the checkboxlist with data from the database in the form of "Yes" and "No" strings. How can I select Yes or No on the checkbox list so the user can view and edit the data?    </p>
  
  <p>I am using a checkbox list rather than radio buttons because the user needs to be able to deselect all checkboxes. </p>
  
  <p>ASPX:</p>
  
  <pre><code>            &lt;asp:CheckBoxList ID="cblCLECompleted" runat="server" RepeatDirection="Horizontal" cssclass="cbTableRow" AutoPostBack="false" Width="50"&gt;
                  &lt;asp:ListItem Text="Yes" Value="Yes"&gt;
                  &lt;/asp:ListItem&gt;
                  &lt;asp:ListItem Text="No" Value="No"&gt;                     
                  &lt;/asp:ListItem&gt;
              &lt;/asp:CheckBoxList&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <pre><code>    private void PopulateAttorneyPopup(int rowIndex)
      {
          GridViewRow row = gvAttorneys.Rows[rowIndex];
          txtAttorneyName.Text = row.Cells[1].Text;
          txtStartDate.Text = row.Cells[2].Text;
          if (row.Cells[3].Text == "Yes")
          {
              cblCLECompleted.Selected = "Yes";
          }
          else
          {
              cblCLECompleted.Selected = "No";
          }
          txtLast4ofSS.Text = row.Cells[4].Text;
      }
  </code></pre>
  
  <p>Thanks for your time and assistance!</p>