Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1663
  • Last Modified:

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.
0
HangTenDesign
Asked:
HangTenDesign
1 Solution
 
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
 
CetusMODCommented:
PAQed with points refunded (250)

CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now