title: How to pass Eval () to Javascript function
body: <p>This is probably really simple for someone who's familiar with Javascript, but I have having trouble calling a function while passing an eval as a parameter. I've got a bunch of dynamic checkboxes that I'm trying to create. I've got the text displaying great, but the checkbox is giving me trouble. The problem is, the value that I'm passing to the checkbox is a string (either "true" or "false") not a bool.</p>
  
  <pre><code>&lt;asp:CheckBox runat="server" AutoPostBack="True" Checked='&lt;%# Eval("Value") %&gt;' Text='&lt;%# Eval("DisplayName") %&gt;'&gt;&lt;/asp:CheckBox&gt;
  </code></pre>
  
  <p>I also created a short javascript function to convert it to boolean</p>
  
  <pre><code>function ConvertToBoolean(value)
  {
       if (value == "true")
       {    return true;}
       if (value == "false")
       {    return false;}
   }
  </code></pre>
  
  <p>I'm not great with javascript, but I've tried everything I could find on SO. Not sure why it's not working for me. Here's what I've tried:</p>
  
  <pre><code>Checked='&lt;%# Eval("Value") %&gt;'
  Checked="'&lt;%# Eval("Value") %&gt;'"
  Checked='&lt;%# "ConvertToBoolean(" + Eval("Value") + ");" %&gt;'
  Checked='&lt;%# "ConvertToBoolean(\"" + Eval("Value") + "\");" %&gt;'
  Checked='&lt;%# Eval("Value", "javascript:ConvertToBoolean({0});") %&gt;'
  Checked="ConvertToBoolean('&lt;%# Eval("Value") %&gt;')"
  </code></pre>
  
  <p>Am I misunderstanding something fundamental here? Is there even a way to do this? </p>