I have a requirement to send the results of a query in emails. I am using two methods:
GetDataTable() : to execute the query and obtain datatable(wh
In the past, I've made an object EmailGrid.cs which inherits from GridView. Then used a method like below to render the HTML into a string.
public string RenderControl()
{
StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter = new StringWriter(stringBuilder);
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
RenderControl(htmlTextWriter);
return stringBuilder.ToString();
}