I get the following parser error message. How can I fix this problem?
The server tag is not well formed.
Code:
<a href="#" class="mySprite id<%# ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1%>">
First of all, your anchor is client side, you should add an attribute of runat="server"
to this. Second, try using it like following.
<a href="#" runat="server" id="mySprite1"
class='<%# "mySprite id" + ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1 %>'>
It might be helpful to review the difference in expressions: http://blogs.msdn.com/b/dancre/archive/2007/02/13/the-difference-between-lt-and-lt-in-asp-net.aspx
The runat="server"
is only needed for databinding.
So, use the <%= %>
syntax instead. Also make sure your quotes aren't getting mixed up, so use '
for the outer one and "
for the inner ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With