在asp.net MVC中保存并显示换行符 [英] Save and display newline in asp.net MVC

查看:370
本文介绍了在asp.net MVC中保存并显示换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在处理社交应用程序中的评论,当我按下文本区域中的输入发布评论时,它会转到下一行,但是当我从评论表中检索数据并显示在html它显示了同一行中的所有内容。

请帮助我这样做,因为它导致了太多延迟的交付。



我想通了应该有一些
但什么时候插入文本?我应该把它保存在数据库中。

请告诉我该如何处理。

Hello,
I am working on comments in a social application and when I press enter in text area to post a comment it goes to next line but when I retrieve data from comment table and display in html it shows everything in same line.
Please help me do it as it is causing too much delay in deliverable.

I have figured out that there should be some
but when to insert it in text? should I save it in database.
Please let me know how should I go about it.

推荐答案

当您在文本区域按ENTER键时,您将获得\ r在.Value属性中,你需要用HTML中的段落标记替换它们,然后将它们显示给用户
when you press ENTER key in text area you will get \r\n in .Value property, you need to replace them with paragraph tag in HTML and then show them to user


这篇关于在asp.net MVC中保存并显示换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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