Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email web form

Status
Not open for further replies.

JasonNevin

Programmer
May 26, 2005
29
GB
I have a web form. It contains repeater controls and generates a data base report in html. I want to have a button that the user can click on and Email report. I can't find any code anywhere to convert that HTML document into an emailable format (and then Email it). Can anyone suggest a way?
 
I've used this successfully for emailing a datagrid...you must have HTML emailing on...

Code:
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Me.DataGrid1.RenderControl(hw)
str = tw.ToString()

then send your email with str as the text...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
That's a good tip on getting html from a control. Thanks, I have been looking for something that will do that.

After getting your html table that is the datagrid, just wrap it in a "<html><body>" & tw.ToString & "</body></html>"

Use this free .net email component:
It lets you send a Text body or HTML body, for this method you would want HTML.
 
Thanks checkai. Any suggestions on how to embed photographs?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top