ASP.NET C# set GridView Column htmlencode to false from C#
-
Hi Experts, I have an issue with the GridView for wich I want to set a column htmlencode property to false. Here is the data source. I have no databound columns because I'm not using SQLDataSource.
public void LoadStories()
{
SqlConnection con = new SqlConnection("Data Source=dpeta-ro;Initial Catalog=MINTPRINT;Integrated Security=True");
SqlCommand cmdSelect = new SqlCommand("select news_id \"id\", title \"title\", news_text \"story\", created_date \"created on\", active from news", con);
SqlDataReader rd;try { con.Open(); rd = cmdSelect.ExecuteReader(); gwNews.DataSource = rd; gwNews.DataBind(); con.Close(); } catch (Exception err) { lblError.Text = err.Message; con.Close(); } }
The news_text column has HTML code that i want the GridView to render as HTML code, without encoding it. Because the GW has the Encode set to true by default i need to change it dynamically. Any ideas? Thank you, Alex
“Be the change you want to see in the world.”