Display HTML tags from database in GridView

Does anyone know how I can display the html in the data within my bound GridView control? Right now the gridview is automatcally using HtmlEncode and showinig the html tags.
HangTenDesignAsked:
Who is Participating?
 
CetusMODConnect With a Mentor Commented:
PAQed with points refunded (250)

CetusMOD
Community Support Moderator
0
 
raterusCommented:
Have you tried this?

<asp:templatefield>
  <itemtemplate>
    <%# Bind("myDBfieldWithHTML") %>
  </itemtemplate>
</asp:templatefield>
0
 
HangTenDesignAuthor Commented:
Yes, I'm using bound data. I'm also creating the columns on the fly. But this is what I found elsewhere on the web to solve the problem:

----------------------------------

                       bf = new BoundField();
                        bf.HeaderText = reader["field_name"].ToString();
                        bf.DataField = reader["field_id"].ToString();
                        bf.SortExpression = reader["field_order"].ToString();
                        bf.HeaderStyle.Wrap = false;
                        bf.HtmlEncode = false;  //This is the line that solved the problem.
                        ChecklistView.Columns.Add(bf);

----------------------------------

HtmlEncode = false; //This is the line that solved the problem.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.