I have a formatted text that contains Bolded, italicsed, and other styles implemented inside the message. I have this message stored in a Database. Now I want to implement these tags into work inside the a field inside the DataList. How do I do it?
<%# Eval("message") %>
Doesn't work. It just shows up the tags as such. Any help?
From stackoverflow
-
If you mean that your "message" contains formatted HTML, you should simply HTMLDecode it after the DataBinder has evaluated the value of the "message" property. For example:
' "message" contains the string "<b>Hello World!</b>" ' Within the DataList: <ItemTemplate> <asp:Label ID="lbl1" runat="server" Text='<%# Server.HtmlDecode(Eval("message").ToString()) %>' /> </ItemTemplate>Cerebrus : lol, np. You can vote up answers that you think have merit. You can also vote up answers that you have accepted. Thanks for accepting! :-)
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.