Concatenate text with Eval
How to concatenate static 开发者_如何转开发text in the start of Eval("")
in asp.net?
try...
Text='<%# "Mr " + Eval("FirstName") + " " + Eval("LastName")%>'
For concating two fields from db you can use string.Concat function in eval()
Text='<%# string.Concat(Eval("FirstName"), " ", Eval("LastName"))%>'
try this: Text='<%# string.Concat("Table No:", " ", Eval("table_no")) %>'
This works fine for me:
<%#Class.something.ToString() & Eval("something_to_eval")%>
Doing this (without single quote) worked for me. And Visual Studio underlines it as a Validation warning.
onclick=<%# "modCbClick('#tbl_" + Eval("ModCode") + "', this)" %>
Here is a good method I am using whereby I want to Concatenate a string to an Eval and use in the CommandArgument of a LinkButton.
Append string to start
CommandArgument='<%# String.Format(string.Concat("TextString", Eval("DBValue")))%>'
Append string to end
CommandArgument='<%# String.Format(string.Concat(Eval("DBValue"), "TextString"))%>'
精彩评论