I have a label in a gridview, and I want to put an awesome icon font inside the label according to the value of a field, my code is:
<asp:Label runat="server" Text='<%# string.Format("<i class='fa fa-{0}'></i>", Eval("[TypeIconFF]")) %>' EncodeHtml="false" />
But it gives me an exception of type System.Web.HttpException (Wrong server label)
I think the error may be generated by single quotation marks
Does anyone have any idea how to solve it?
Thanks in advance
2
Answers
The problem is the second set of single quotes around
fa fa-{0}
.Change them to double quotes and escape them and it will work.
Try:
Not sure if you need the [], but then this:
you also should not need the html encode option.
So, with this grid:
I also like the fa-lg (larger).
So this gv:
And code :
and I get/see this: