This function returns an HTML table:
private HtmlTable ConvertToHtml(DataTable dataTable) { var htmlTable = new HtmlTable(); if (dataTable == null) return htmlTable; //null reference, empty table HtmlTableRow htmlRow = new HtmlTableRow(); htmlTable.Rows.Add(htmlRow); foreach (DataColumn column in dataTable.Columns) htmlRow.Cells.Add(new HtmlTableCell() { InnerText = column.ColumnName }); foreach (DataRow row in dataTable.Rows) { htmlRow = new HtmlTableRow(); htmlTable.Rows.Add(htmlRow); foreach (DataColumn column in dataTable.Columns) htmlRow.Cells.Add(new HtmlTableCell() { InnerText = row[column].ToString() }); } return htmlTable; }
I would like to know how I can get innerHTML HtmlTable .
I am currently doing this:
var bodyhtml = ConvertToHtml(r.tblSalesVolume); MessageBox.Show(bodyhtml.InnerHtml);
but he says that he does not have such a property.
How to get HTML code for a table?
l --''''''--------- '' '' '' '' '' '' '
source share