?
Solved

Stringbuilder

Posted on 2012-03-15
4
Medium Priority
?
239 Views
Last Modified: 2012-03-16
Hello,

I am using string builder to create a table that will go into an email.

Basically this works fine but what I want to do is have a table, the the first row spans across several columns.
then the second row would have several columns.

Is there anyway to have a table row span multiple columns using SB?

Thank You.
0
Comment
Question by:Wildone63
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Accepted Solution

by:
nepaluz earned 2000 total points
ID: 37725926
Not sure how you are doing this, but if you want a table row to span several column then all you do is add the colspan attribute to the td, i.e

<table>
<tr>
<td colspan="2">Spans two columns</td>
</tr>
<tr>
<td>First Column</td>
<td>Second Column</td>
</tr>
</table>
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 37726111
Another approach is to generate an HtmlTable structure, and then render the control to a StringWriter and an HtmlTextWriter.
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37726570
private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress("your_email_address@gmail.com");
                mail.To.Add("to_address");
                mail.Subject = "Test Mail - 1";

                mail.IsBodyHtml = true;
                string htmlBody;

                htmlBody = "<table><tr><td colspan="2">2 col</td></tr><tr><td>First Column</td><td>Second Column</td></tr></table>";

                mail.Body = htmlBody;

                SmtpServer.Port = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
                SmtpServer.EnableSsl = true;

                SmtpServer.Send(mail);
                MessageBox.Show("mail Send");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }

Open in new window


Ref:http://csharp.net-informations.com/communications/csharp-html-email.htm
Have a look at this one as well:-
http://www.emailarchitect.net/easendmail/kb/csharp.aspx?cat=6;

you can always replace the htmlbody string with stringbuilder.
0
 
LVL 1

Author Closing Comment

by:Wildone63
ID: 37729257
Exactly what I was looking for.

Thank You!
0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question