[英]displaying email body as html in c# textbox
I am imitating my email client on a asp page. 我在asp页面上模仿我的电子邮件客户端。 I have a gridview that displays things like from,subject,attachments, and the body. 我有一个gridview,它显示诸如from,subject,attachments和body之类的东西。 The body is html. 正文是html。 When I view it in the grid view and set htmlencode= 'false' i can see it correctly. 当我在网格视图中查看并设置htmlencode ='false'时,我可以正确看到它。 However, I want to the display it inside a textbox, so it can edit and forward it or reply. 但是,我想在文本框中显示它,以便它可以编辑,转发或回复。
Any ideas? 有任何想法吗?
Thanks, 谢谢,
Load the HTML into a rich text editor to enable to user to edit it - be aware that most rich text editors out there are not designed to create email safe HTML and they will require a substantial amount of tweaking if you are going to support more than the most basic formatting. 将HTML加载到富文本编辑器中,以使用户能够对其进行编辑-请注意,目前大多数富文本编辑器都不旨在创建电子邮件安全的 HTML,并且如果您要支持以下内容,则需要进行大量调整。最基本的格式。
Some example rich text editors: 富文本编辑器的一些示例:
您需要使用HTML编辑器/ TextBox ,我们使用的是DevExpress组件,质量很高但不是免费的,还有Telerik或Infragistics之类的替代品,还有免费的替代品...请参见此处: 最佳免费的wysiwyg html编辑器
You can try dinamycly add html code to page: 您可以尝试dinamycly将html代码添加到页面:
<div runat="server" id="myDiv">
</div>
and then set its InnerHtml property from the code-behind: 然后从后面的代码中设置其InnerHtml属性:
myDiv.InnerHtml = "your html here";
but with this way you cannot edit it... 但是用这种方式你不能编辑它...
if you are using Devexpress Controls, 如果您使用的是Devexpress控件,
you can use ASPxHTMLEditor. 您可以使用ASPxHTMLEditor。
It works exactly as your requirement is. 它完全按照您的要求工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.