title: Mark A CheckBox As Checked If SQL Data = 1
body: <p>I have a column in my sql server database named "option_key", it's a bit column that is either 1 or 0 (one indicates a right answer, 0 indicates wrong). 
  I have created a web form that queries the database and returns data into several different TextBoxes and GridViews (it's basically a form that searches an item and returns all pertinent information). I am new to C# and ASP, but I'm basically done.</p>
  
  <p>However, I cannot for the life of me figure out how to have my CheckBoxes show as checked after the "search" button is clicked and the fields on my form are populated. Essentially, what I need is to have a CheckBox appear as checked if the row in my database = 1, and have the other CheckBoxes not be checked if the row = 0. I am trying to get a checkmark to appear in my CheckBox if the row in my databases column = 1. I have zero code for the checkbox as I am completely lost, but here is some of the code for the form if that helps to clarify at all:</p>
  
  <pre><code> SqlDataAdapter sda3 = new SqlDataAdapter("select(select item_id from item_header ih where related_item_header_id = ih.item_header_id) as [Enemy Item ID], (select item_stem from item_header ih where related_item_header_id = ih.item_header_id) as [Item Stem],[social_order_type] as [Type] FROM[AvokaItemDev].[dbo].[social_order] sc join item_header ih on sc.item_header_id = ih.item_header_id  join social_order_type sct on sc.social_order_type_id = sct.social_order_type_id where item_id ='" + cloneItemID.Text + "'", con);
          DataSet dt3 = new DataSet();
          sda3.Fill(dt3);
          GridView3.DataSource = dt3;
          GridView3.DataBind();
  
  
  //textbox code
   SqlCommand com12;
          String str12;
          //item_detail code for item status
          str12 = "select m.mcs_desc from mcs_code m left join item_header h on m.mcs_code_id = h.mcs_code_id where h.item_id ='" + cloneItemID.Text + "'";
          com12 = new SqlCommand(str12, con);
          SqlDataReader readerTwelve = com12.ExecuteReader();
          if (readerTwelve.Read())
          {
              txtMCSdesc`enter code here`.Text = readerTwelve["MCS_desc"].ToString();
              readerTwelve.Close();
          }
  </code></pre>