Multiple eval in label text

Why doesnt this work:

<asp:Label ID="lblName" runat="server" Text='<%# Eval("Title")%> <%# Eval("Forename")%> <%# Eval("Surname")%>' ></asp:Label>

And what is the best way to achive this?



Sorry, I wasn’t getting an error but now I am!:

Compiler Error Message: CS1040: Preprocessor directives must appear as the first non-whitespace character on a line

Do you get an error message? If so, what is it?


Not really! The label is part of a gridview itemtemplate so i would like to do this inline if poss?

.cs string

public static string value_;
value_ ="xxxxx";

.aspx string



Try doing it like this:

<asp:Label ID="lblName" runat="server" Text='<&#37;# Eval("Title")+" "+Eval("Forename")+" "+Eval("Surname")%>' ></asp:Label>