如何显示来自一个ASP.NET MVC视图存储在数据库中的HTML? [英] How to display HTML stored in a database from an ASP.NET MVC view?
本文介绍了如何显示来自一个ASP.NET MVC视图存储在数据库中的HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有HTML code发出由FCKEditor的存储在数据库中,并想显示(以及渲染),它到一个视图。因此,例如,一些存储为:
I have HTML code emitted by FCKEditor stored in a database and would like to display (well render) it onto a view. So, for instance, something stored as:
<>pre<>This is some sample text<>pre</>
将显示给用户作为
Will be displayed to the user as:
This is some sample text
(连同相应的样式pre格式文本)
(With the appropriate style for pre-formatted-text)
该视图已经拥有所需的字符串,从的ViewData code>显示,我只是不知道什么是最好的方式展示给用户。
The view already has the required string to display from ViewData
, I'm just not sure what the best way to show it to the user is.
推荐答案
尝试
<%= System.Web.HttpUtility.HtmlDecode(yourEncodedHtmlFromYouDatabase) %>
更多信息这里@ MSDN在线。
心连心!
这篇关于如何显示来自一个ASP.NET MVC视图存储在数据库中的HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文