Avatar of David C
David C
Flag for United Kingdom of Great Britain and Northern Ireland asked on

ASP.NET chart not being embedded in email

Hi Experts,

I am using the code below to capture a pages HTML and send it in an email. The issue is I have introduced a ASP.NET chart but its not being sent in the email? Is there anything I need to do to the chart?

 Dim renderedOutput As StringBuilder
        Dim strWriter As StringWriter
        Dim tWriter As HtmlTextWriter
        Dim html As String

        'create a HtmlTextWriter to use for rendering the page
        renderedOutput = New StringBuilder
        strWriter = New StringWriter(renderedOutput)
        tWriter = New HtmlTextWriter(strWriter)
        'render the page output
        html = renderedOutput.ToString

        mail.Body = html

Open in new window


Avatar of undefined
Last Comment
David C

8/22/2022 - Mon

Are you using javascript (or jQuery) to create the chart? You can only send simple HTML in an e-mail.

You could try inserting the chart through an iFrame maybe.
David C

The chart is ASP.NET object that I just dragged from the toolbox and bound some data to it

Can you check the source of the result in a webpage? It will probably show javascript code to generate the chart.
Your help has saved me hundreds of hours of internet surfing.
David C

Thanks ingriT this is the URL

Open in new window

I am only assuming but I think this will be different everytime it runs. How would I access the generated path during runtime that way I can embedd that URL in the email and see if it opens

You could also create a webpage (ie. Chart.aspx) that only shows this chart, and that way, you can always link it to this page, and not the chart inside the page.
David C

That sounds like a great idea. How would I link the page? iFrame? or is there a better way
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
David C

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Yes, an inline image is probably your best option, good luck!
David C

Found a cleaner solution to embed the chart image by saving the image first then embedding the image to the email.

Also added <td><img src="cid:IMAGE_ID"></td> to the source to location of chart.