-1

How can I concatenate two strings in a id of a unordered list. The problem is :

<li id='autor<%# Eval("id") %>' runat="server"/>

What I have inside of <%# Eval("id") %> is the id of the author I and want in my id the string autor plus the id.

How can I do that?.

With the id it's different than the Text, so I don't know how to do that.

zoit
  • 617
  • 2
  • 20
  • 41
  • 1
    possible duplicate of [Concatenate two or more strings in inline code ASP.NET](http://stackoverflow.com/questions/7668947/concatenate-two-or-more-strings-in-inline-code-asp-net) – Shantanu Gupta May 30 '15 at 15:40
  • 1
    Duplicate `'<%# "Mr " + Eval("FirstName") + " " + Eval("LastName")%>'` http://stackoverflow.com/questions/5100716/concatenate-text-with-eval – Shantanu Gupta May 30 '15 at 15:41
  • It's no duplicate because this is with the Text no with Id, With Id this not works, – zoit May 30 '15 at 15:48
  • 1
    you simply need typecasting. and try to google your question before posting. – Shantanu Gupta May 30 '15 at 15:54

2 Answers2

2
'<%# "Mr " + Eval("ID") & Eval("LastName")%>
Shantanu Gupta
  • 20,688
  • 54
  • 182
  • 286
0

You can achieve it using:

<li id='<%# "Author"+ Eval("id") %>' runat="server"/>
Zaheer Ahmed
  • 28,160
  • 11
  • 74
  • 110