Saad Suri Saad Suri - 1 year ago 68
SQL Question

Use label for a css class name

I want to use a label value for a css class name.

I am getting a label value from database through Eval and want to use it for a css class name

Here is what I am doing

<span class="<asp:Label ID="lbl_icon" runat="server" Text='<%# Eval("icon")%>'></asp:Label>"></span>

but I'm not getting the result which i want.

Answer Source

There isn't any need to use a Label control there. You could just try the following:

<span class='<%# Eval("icon")%>'></span>