In my web application, i write a code for sending mail the grid view data in a body of the mail. It is coming, but can i added color to the GridView header, can i apply style for that? My code like this:
private string GridViewToHtml(GridView gv)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(sw);
grdsap.RenderControl(hw);
return sb.ToString().Replace("<br />", "\n");
}
protected void btn_click(Object sener, Event args)
{
mail.Body = "Day wise Reports: " + DateTime.Now.ToShortDateString().Replace("<br />", "\n") + GridViewToHtml(grdsap);
mail.IsBodyHtml = true;
mail.To.Add(mailid);
}
Probably you want the coloring to be done trough CSS. If the email hits the receiver it needs to be able to load the correct CSS settings.
You could try to put the CSS inline with your markup or you need to put your CSS file on a public location and have a full path in your email HTML.