Rod Rod - 2 months ago 7x
ASP.NET (C#) Question

My data table has some html elements in it, how to databind as html

One of my columns in my data table contains a value like the following:

<strong>Hello World</strong>

How do I databind that to my GridView so it will show bold and not the words strong?


It seems using the BoundField will put out the Entity characters instead of the actual characters (e.g. &lt; instead of <). I've tested this and it seems to work if you just Eval your column in a TemplateColumn like so:

<asp:TemplateField HeaderText="Link">
        <%# Eval("MyField") %>