title: DataBound CheckBoxList
body: <p>I have a website programmed in Asp.Net and use a ListView for displaying data. The data is coming from a LinqDataSource.</p>
  
  <p>In my EditItemTemplate I have a CheckBoxList which consist of:</p>
  
  <pre><code>&lt;asp:CheckBoxList runat="server" ID="TypeCheckBoxList" RepeatColumns="2"&gt;
   &lt;asp:ListItem Value="128"&gt;6.-10. klasse&lt;br /&gt;Norddjurs vejleder&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="64"&gt;6.-10. klasse&lt;br /&gt;Syddjurs vejleder&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="32"&gt;Gået ud af skolen&lt;br/&gt;Norddjurs vejleder&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="16"&gt;Gået ud af skolen&lt;br/&gt;Syddjurs vejleder&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="8"&gt;Ekstra støtte&lt;br/&gt;Norddjurs vejleder&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="4"&gt;Ekstra støtte&lt;br /&gt;Syddjurs vejleder&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="2"&gt;Kontakt&lt;/asp:ListItem&gt;
   &lt;asp:ListItem Value="1"&gt;Om os&lt;br /&gt;Medarbejdere&lt;/asp:ListItem&gt;
  &lt;/asp:CheckBoxList&gt;
  </code></pre>
  
  <p>I have a column called Type in my db and it is a tinyint. Therefore I can say (byte)Eval("Type").</p>
  
  <p>But how do I databind my Eval("Type") to the CheckBoxList so if Eval("Type") is 3, then the two last items are selected?</p>
  
  <p>I have tried setting a hidden value which binds to Type and then in the CheckBoxList OnLoad setting the selected items. But that did'nt work.</p>