How to set a control ID in ListView Template dynamically?
<p>A have a ListView that is rendered with multiple items.<br>
Now I want to toggle some HTML attributes with JQuery. Therefore it would be best to have access to these elements via an unique ID.</p>

<p>But trying to create a "dynamic" and therefore unique ID by</p>

<pre><code>&lt;tr runat="server" ID='&lt;%# this.GetUniqueID() %&gt;'&gt;
&lt;/tr&gt;
</code></pre>

<p>results in an error that tells me that the ID needs to be simple and cannot be set by a call to a method.</p>

<p>I know that I can dynamically create controls in the code-behind and set the ID there.  But in this case, I'd rather like to let the content be rendered by the ListView itself.</p>

<p>That brings me to the conclusion that the idea of setting a dynically ID in the Template is totally wrong. How can I achieve the desired behaviour?</p>

<p><strong>Edit</strong>: Ok I just found out, that I can set the ID with a BindingExpression, like</p>

<pre><code>ID='&lt;%# Eval("MyColumnWithUniqueID") %&gt;'
</code></pre>

<p>Still, is there another, or even better solution to this?</p>
