Converted c# datatable to HTML... how to add grid around the cells in HTML table?
<p>So using the answer found on this link:</p>

<p><a href="https://stackoverflow.com/questions/9792882/creating-html-from-a-datatable-using-c-sharp/9792946#9792946">Creating HTML from a DataTable using C#</a></p>

<p>I successfully converted by datatable to HTML and it shows as a table in my email...</p>

<p>I know there must be a place to put the style for adding grid lines around the cells but I for the life of me can't find the right spot. I have successfully added a border around the entire table however...</p>

<pre><code>DataTable dt = new DataTable();
sdaGetValidation.Fill(dt);   

StringBuilder sb = new StringBuilder();
sb.AppendLine("&lt;html&gt;");
sb.AppendLine("\t" + "&lt;body&gt;");
sb.AppendLine("\t\t" + "&lt;table&gt;");
sb.Append("&lt;table border='1px' solid line black cellpadding='5' cellspacing='0' ");
sb.Append("style='border: solid 1px Silver; font-size: x-small;'&gt;");

sb.Append("\t\t" + "&lt;tr&gt;");

foreach (DataColumn dc in dt.Columns)
{
    sb.AppendFormat("&lt;td&gt;{0}&lt;/td&gt;", dc.ColumnName);
}

sb.AppendLine("&lt;tr&gt;");

foreach (DataRow dr in dt.Rows)
{
    sb.Append("\t\t\t" + "&lt;tr&gt;");

    foreach (DataColumn dc in dt.Columns)
    {
        string cellValue = dr[dc] != null ? dr[dc].ToString() : "";
        sb.AppendFormat("&lt;td&gt;{0}&lt;/td&gt;", cellValue);
    }

    sb.AppendLine("&lt;/tr&gt;");
}

sb.AppendLine("\t\t\t" + "&lt;/table&gt;");
sb.AppendLine("\t" + "&lt;/body&gt;");
sb.AppendLine("&lt;/html&gt;");

MessageBox.Show(sb.ToString());
</code></pre>

<p>I am not sure if there was a way to rehash the old answer so I apologize if there is a way to do so...</p>

<p>Not much of an HTML guy so I feel like this should be an easy win for someone who knows it better than I.</p>

<p>I added 'solid line black' to this line:</p>

<pre><code> sb.Append("&lt;table border='1px' solid line black cellpadding='5' cellspacing='0' ")
</code></pre>

<p>But no joy....</p>