如何显示存储在数据库中的格式化的html? [英] How can I display formatted html stored in database?

查看:135
本文介绍了如何显示存储在数据库中的格式化的html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上搜索了几天,以找到一种存储和查看(检索)格式化文档的方法.

据我了解,人们可以:

答:在SQL Server(数据类型为文本")中存储格式化的文档(使用纯html格式,就像您复制gmail文本一样).

B:然后再次将其输出到标签或文本框,它的格式将相同(粗体,回车等).


我已经完成了A部分((当我将鼠标悬停在SSMS中的字段上时,它至少显示了与原始文档匹配的间距和行跳过部分),但是文本在我的控件中显示为一条流畅的纯文本行,即使文本框设置为多行.标签填充得更好.

我在带有2.0框架的Visual Studio中使用C#asp.net

是否有捷径可寻?

I''ve been searching the net for days for a way to store and view (retrieve) formatted documents.

It was my understanding that one could:

A: store a formatted document (With pure html like you get from copying gmail text) in sql server (a datatype of ''Text'').

B: then output it again to a label or textbox and it would have the same formatting (Bold, carriage returns, etc).


I''ve accomplished part A, (when I hover over the field in SSMS, it shows at least the spacing and line skips that match the original doc) but text shows up in my controls as one fluid line of plain text, even with the textbox set to multiline. Labels populate no better.

I''m using C# asp.net in Visual Studio with the 2.0 framework

Is there an easy way to do this? Thanks in advance!

推荐答案

Brian Fay写道:
Brian Fay wrote:

B:然后输出它再次输入标签或文本框,其格式将相同(粗体,回车等).

B: then output it again to a label or textbox and it would have the same formatting (Bold, carriage returns, etc).



不,您可以使用文字控件来做到这一点.



No, you''d use a Literal control to do that.


我将需要熟悉文字控件.关于如何使用它的任何提示.我会在同时进行查找.
I will need to familiarize myself with the Literal Control. Any hints on how to use it. I''ll look it up in the mean time.


发布于19小时前
克里斯蒂安说对了!谢谢!

我查找了文字控制",这就是我所需要的:

http://blogs.techrepublic.com.com/programming-and-development/?p=618
Posted 19 hours ago
Christian had it right! Thanks!

I looked up ''literal control'' and that was all I needed:

http://blogs.techrepublic.com.com/programming-and-development/?p=618


这篇关于如何显示存储在数据库中的格式化的html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆