title: Using datasource with CheckBoxList
body: <p>I use CheckBoxList in my <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow">Windows Forms</a> application and am trying to apply a datasource for it.</p>
  
  <p>Having a DataTable, 'dt', with columns <code>id</code>, <code>name</code> and <code>ischecked</code>, I use such code:</p>
  
  <pre><code>((ListBox)MyCheckBoxList).DataSource = dt;
  ((ListBox)MyCheckBoxList).DisplayMember = "name";
  ((ListBox)MyCheckBoxList).ValueMember = "id";
  </code></pre>
  
  <p>How do I set CheckState for all items in MyCheckBoxList?</p>
  
  <p>I keep this value in my datatable and want to link them with MyCheckBoxList.</p>