How to email a datagrid

  • Thread starter Thread starter Dave Tichenor
  • Start date Start date
D

Dave Tichenor

how to you email a datagrid as a html email message.

this is what i have

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

'Create MailMessage instance, set properties, and send

Dim Mail As New MailMessage

Dim sw As New System.IO.StringWriter

Dim hw As New System.Web.UI.HtmlTextWriter(sw)

Dim body As String

'Render DataGrid output as Html

EligInfo.RenderControl(hw)

'Dim dataGridHTML As String = hw.ToString()

Mail.To = "(e-mail address removed)"

Mail.Cc = ""

Mail.Bcc = ""

Mail.Subject = "Requested Eligibility Change"

'Mail.BodyFormat = MailFormat.Html

Mail.Body = sw.ToString

Mail.From = "(e-mail address removed)"

SmtpMail.SmtpServer = "Mailserver"

SmtpMail.Send(Mail)
 
Hi Dave,


I'm reviewing this post and found that you provided some of your research
results and share it with others,yes? I think the solution you provided so
informative that it'll save a lot time for many others who're searching
for the similiar things. Thanks very much for posting here and sharing your
experience. In the meantime, if you have any questions or other opinions,
please always feel free to post here.




Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top