---
title: "DataTable HTML in Add Rows new object[]"  
description: "DataTable HTML in Add Rows new object[]"  
author: "Anonymous User"  
published: 2015-01-18  
updated: 2015-01-18  
canonical: https://www.mindstick.com/forum/12873/datatable-html-in-add-rows-new-object  
category: "asp.net"  
tags: ["c#", "html", "gridview"]  
reading_time: 1 minute  

---

# DataTable HTML in Add Rows new object[]

I created a [DataTable](https://www.mindstick.com/blog/195/datatable-in-ado-dot-net) and I am adding new rows with new object[].

DataTable dt = new DataTable();

dt.Rows.[Add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript)(new object[] { "Hello", "[World](https://yourviews.mindstick.com/view/87468/defining-humanity-as-given-in-sanatan-dharma-best-in-world)", "<i>[Test](https://yourviews.mindstick.com/story/1427/explosive-facts-about-trinity-test-world-s-first-nuclear-bomb)</i>" });

In the object[] [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) I got some [values](https://www.mindstick.com/forum/327/sum-textbox-values) that are shown in the DataTable.

I would like to add some [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) styling, is this possible like above? I would like to have the Testshown as italic.

Thanks in advance.

## Replies

### Reply by Anonymous User

The DataTable stores data, it it not responsible for any format or styling. So it depends on where you want to diplay it, if it's an ASP.NET-GridView you could use the RowDataBound event. HttpUtility.HtmlDecode should work to prevent that your html will be encoded:

```
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {    if (e.Row.RowType == DataControlRowType.DataRow) {       e.Row.Cells[0].Text = Server.HtmlDecode(e.Row.Cells[0].Text);    }}
```


---

Original Source: https://www.mindstick.com/forum/12873/datatable-html-in-add-rows-new-object

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
