Question

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?

Doesn't work. It just shows up the tags as such. Any help?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top