I am using TinyMce to compose emails then I am saving emails in database. There need to open email in read only mode as well. Top show mail just in readonly mode I inserted email tags in a div
but in display inserted text was not begin shown as a display of HTML tags, rather tags where there in div
. I am using div.InnerHtml
to add email HTML but div
is showing tags like:
<p>
<strong>hi,</strong>
</p>
<div>
<span style="color: #800000;">
Since the application that he demands require information gathering,
screen designi开发者_开发百科ng and development, I have forwarded the project to the team
I am working with.
</span>
</div>
<div><br /></div>
<div>
<span style="color: #ff6600;">
<strong>
<span style="font-size: medium;">Thanks,</span>
</strong>
</span>
</div>
<div>
<strong>
<span style="font-size: medium;"><br /> </span>
</strong>
</div>
<div style="text-align: right;">
<span style="font-size: medium;">
<em>
<span style="text-decoration: underline;">
<span style="color: #339966;">Mr. Bota</span>
</span>
</em>
</span>
<br />
</div>
You should use an asp.net Literal
control, and set the LiteralMode
to `PassThrough'. You can read a bit more here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literalmode.aspx.
This should allow the HTML you emit to actually be rendered, instead of seeing the tags.
Use a literal control for this:
<asp:Literal ID="litEmailBody" runat="server" />
And in the code behind:
litEmailBody.Text = htmlContent; //your HTML markup
精彩评论