T
Tips
The code below renders a datagrid and send its contents by email.
Dim SB as New StringBuilder()
Dim SW as New StringWriter(SB)
Dim htmlTW as New HtmlTextWriter(SW)
YOUR_DATAGRID.RenderControl(htmlTW)
Dim dataGridHTML as String = SB.ToString()
Dim MyMail As MailMessage = New MailMessage()
MyMail.From = From
MyMail.To = To
MyMail.Subject = Subject
MyMail.Body = dataGridHTML
MyMail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = MailServer
SmtpMail.Send(MyMail)
Source : http://www.mycodebank.com/Snippet,78.aspx
Dim SB as New StringBuilder()
Dim SW as New StringWriter(SB)
Dim htmlTW as New HtmlTextWriter(SW)
YOUR_DATAGRID.RenderControl(htmlTW)
Dim dataGridHTML as String = SB.ToString()
Dim MyMail As MailMessage = New MailMessage()
MyMail.From = From
MyMail.To = To
MyMail.Subject = Subject
MyMail.Body = dataGridHTML
MyMail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = MailServer
SmtpMail.Send(MyMail)
Source : http://www.mycodebank.com/Snippet,78.aspx