HTML tags are returned from the SQL Server database

baxtalo
baxtalo used Ask the Experts™
on
My users submit their text with a wysiwyg text editor. When I return the submitted values the HTML tags are also returned. How could I avoid this and see the formatted text instead?
Any help is appreciated.

<asp:BoundField HeaderText="Message" DataField="Message" ItemStyle-HorizontalAlign="Left" ></asp:BoundField>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
I would say to use a contenttemplate and then bind to a label directly! This way the html will get rendered in the browser and you will be able to see the formatted text!

hope this helps!

Author

Commented:
Yes, it helped. Thank you very much. This is what made it work:

<asp:TemplateField HeaderText="Message" ItemStyle-HorizontalAlign="Left" >
<ItemTemplate><%# Eval("Message") %>
</ItemTemplate>
</asp:TemplateField>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial