ASP.NET C# 窗体 - 换行符问题
本文关键字:换行符 问题 窗体 NET ASP | 更新日期: 2023-09-27 18:36:06
首先感谢您为我看这个,因为它让我难倒了!
我有一个表现不佳的表单,如果有人可以向我解释如何对其进行编码,以便它正确显示在单独的行上,那就太好了。
法典:
sb.AppendLine("Name: " + name.Text);
sb.AppendLine("Email: " + email.Text);
sb.AppendLine("Phone: " + phone.Text);
sb.AppendLine("Project Location: " + address.Text);
sb.AppendLine("Project Description: " + description.Text);
sb.AppendLine("Design ideas: " + design.Text);
sb.AppendLine("How did you Hear about us: " + howDidYouHearAboutUs.Text);
m.Body = sb.ToString();
m.IsBodyHtml = false;
结果是:
Name: Mark Shawe
Email: mark@theshawes.com
Phone: 0223881849
Project Location: Hi, This is a test quote from the new website, please forward this to Jim, thanks, Mark Shawe.
Project Description: Test
Design ideas: Yes, I require any landscape design ideas How did you Hear about us: Website Internet
在最后一行中,"您是如何得知我们的:网站互联网"应该像所有其他行一样放在新的行上。
我是新手,有点难倒,所以任何帮助将不胜感激。
谢谢
而不是使用:
sb.AppendLine("Name: " + name.Text);
sb.AppendLine("Email: " + email.Text);
sb.AppendLine("Phone: " + phone.Text);
sb.AppendLine("Project Location: " + address.Text);
sb.AppendLine("Project Description: " + description.Text);
sb.AppendLine("Design ideas: " + design.Text);
sb.AppendLine("How did you Hear about us: " + howDidYouHearAboutUs.Text);
尝试使用:
sb.Append("Name: " + name.Text);
sb.Append(Environment.NewLine);
sb.Append("Email: " + email.Text);
sb.Append(Environment.NewLine);
sb.Append("Phone: " + phone.Text);
sb.Append(Environment.NewLine);
sb.Append("Project Location: " + address.Text);
sb.Append(Environment.NewLine);
sb.Append("Project Description: " + description.Text);
sb.Append(Environment.NewLine);
sb.Append("Design ideas: " + design.Text);
sb.Append(Environment.NewLine);
sb.Append("How did you Hear about us: " + howDidYouHearAboutUs.Text);
sb.Append(Environment.NewLine);