我只是出于好奇而想知道是否有可能在HTML或asp.net页面的数据库中显示大型文本并具有适当的缩进和间距?
截至目前,我已将其显示在文本框中,并且我正在使用我网站中包含的突出显示特定文本功能,该功能仅在文本长度大于实际文本框时才起作用。 所以我想在页面上显示数据并考虑使用Response.Write,但显示的文本全部聚集在一起,没有适当的缩进或间距。
例如,而不是......“嘿,每个人今天大家都在做什么?我是样本文本”......可以将其显示为......
“嘿大家
今天大家怎么样? 我是示例文本“
任何人都可以指导我可以使用或知道任何信息的任何正确方法
I was just wondering out of curiosity if it was possible to display large text from a database in a HTML or asp.net page with proper indenting and spacing?
As of right now, I have it displayed in a textbox and I'm using a highlight specific text feature incorporated in my site that doesn't function ONLY when the length of the text is greater then actual textbox. So I was thinking of displaying the data on a page and considering using Response.Write but the displayed text is all bunched together without proper indenting or spacing.
Ex.) instead of..."Hey Everyone how is everyone doing today? I am sample text"...is possible to display it as...
"Hey Everyone
How is everyone today? I am sample text"
Would anyone guide to any proper method that I could use or know of any info
最满意答案
新行将在文本后面的代码中\ r \ n
现在,您可以在HTML中使用如下所示的Span或Literal控件
HTML方面
<span id="span" runat="server"></span> <asp:Literal id="literal" runat="server"></asp:Literal>代码背后
span.InnerHtml = yourtext.Replace("\r\n","<br/>")New Line will be like \r\n in code behind text
Now, you can use Span or Literal control like below in HTML
HTML Side
<span id="span" runat="server"></span> <asp:Literal id="literal" runat="server"></asp:Literal>Code Behind side
span.InnerHtml = yourtext.Replace("\r\n","<br/>")更多推荐
发布评论