How do I append a value from an object I'm iterating to the ASP.NET control ID
<p>I want to accomplish the following</p>

<pre><code>&lt;ul&gt;
&lt;% foreach (var foo in foos) { %&gt;
    &lt;li&gt;&lt;input id="foo&lt;%=foo.Bar %&gt;" runat="server" type="checkbox"/&gt;&lt;/li&gt;
&lt;% } %&gt;
&lt;/ul&gt;
</code></pre>

<p>But it gives me the error</p>

<blockquote>
  <p>Error 2   'foo&lt;%=foo.Bar %>' is not a valid identifier.</p>
</blockquote>

<p>EDIT:</p>

<p>This seems to work, but of course I don't get access to the checkboxes in the code-behind. I have to use JavaScript</p>

<pre><code>&lt;ul&gt;
&lt;% foreach (var foo in foos) { %&gt;
    &lt;li&gt;&lt;input id="&lt;%="foo" + foo.Bar %&gt;" type="checkbox"/&gt;&lt;/li&gt;
&lt;% } %&gt;
&lt;/ul&gt;
</code></pre>
