embed HTML table using VB

  • Thread starter Thread starter Aur_Ros
  • Start date Start date
A

Aur_Ros

I am showing a table in a web page, I need help to email this table,
please any sugestion ....? thanks!!
 
Sending html emails is as simple as the code below:

<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%
MailMessage msgMail = new MailMessage();
msgMail.To = "blah";
msgMail.Cc = "blah blah";
msgMail.From = "blah";
msgMail.Subject = "the subject text";

msgMail.BodyFormat = MailFormat.Html;
string strBody = "<html><body><b>Hello World</b>" + " <font
color=\"red\">ASP.NET</font></body></html>";
msgMail.Body = strBody;

SmtpMail.Send(msgMail);

%>

If your table however is within an asp.net page you'll have to acquire it as
a string that can be included as the html body of the mail. I would suggest
you take a read of this little snippet by Rick Strahl that explians
capturing output from a rendered web page.

http://www.johntimney.com/home/redir.aspx?=http://west-wind.com/weblog/posts/481.aspx

You'll then need to work out how to pick out your table if thats all you
require.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
 
thanks a lot John!!, yes that is what I need to do, I need to Know how
to get HTML code of that table created dynamically in the web page !!
 
The easiest way is usually to mark the table, by surrounding it with custom
tags !<--tablestarts-> !<--tableends-> then crop the string captured in the
render event using ther .net string methods.

or if yor doing it client side then wrap your table with a specific div
identifier and use javascripts innerHTML method and then post it to a page
that will invoke your mail method.

<div id= "myTable">This is my table.</div>

something like : document.getElementId("myTable").innerHTML .

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
 
Back
Top