开发者

Concatenate text on 3 different textboxes to make bulleted list in email using VB.NET

i have 3 textboxes on an asp.net page and i would like to send the text on all those textboxes as an email message body when a button is clicked. I want each text on each textbox to appear on a new line(this i can do), but i also want the lines to be bulleted. Something like

开发者_如何学Python
  • Text on Textbox1
  • Text on Textbox2
  • Text on Textbox3

Thank you in advance.


If you are happy with HTML in the message body then create a HTML unordered list as follows:

C#:

StringBuilder body = new StringBuilder()
        .Append("<ul><li>")
        .Append(txtBoxOne.Text)
        .Append("</li><li>")
        .Append(txtBoxTwo.Text)
        .Append("</li><li>")
        .Append(txtBoxThree.Text)
        .Append("</li></ul>");

MailMessage mMailMessage = new MailMessage();
mMailMessage.Body = body.ToString();
mMailMessage.IsBodyHtml = true;

VB.NET:

 Dim body = New StringBuilder()
 body.Append("<ul><li>")
 body.Append(txtBoxOne.Text)
 body.Append("</li><li>")
 body.Append(txtBoxTwo.Text)
 body.Append("</li><li>")
 body.Append(txtBoxThree.Text)
 body.Append("</li></ul>")

 Dim mMailMessage = New MailMessage()
 mMailMessage.Body = body.ToString()
 mMailMessage.IsBodyHtml = True
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜