I have a repeater in C#, which generates unique li tags with IDs and have some other elements.
<li id="<%# Eval("myID") %>">
<a id="<%# Eval("myID") %>"></a>
</li>
I get a markup error in VS, that ‘Another object already exists with ID <%# Eval(“myID”) %>’
Why I can’t use <%# Eval(“myID”) %> multiple times in the page? It compiles and runs, just it’s marked as a warning..
it’s C# 4.0, asp.net
Did you want to give the
liand theathe same ID?You can use
Evalas many times as you’d like. You’re using that value as the ID for two elements, though, and that’s what VS is complaining about.I might suggest