How to email a datagrid

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)
 
S

Steven Cheng[MSFT]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top