在Div或Span标签中不显示我在Textarea中以相同格式输入的文本 [英] Not Showing Text Which I Enter In Textarea In Same Format In Div Or Span Tag

查看:250
本文介绍了在Div或Span标签中不显示我在Textarea中以相同格式输入的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用textarea来允许用户填写一些信息。



用户可以在其中输入多行,并按两次段落输入。



提交表格时,我在数据库中保存textarea文本,就像

test \\\\ n问候\\\\ n你的。



虽然从textarea中以相同方式显示的数据中获取数据,但用户已输入但未在span或div标签中显示正确。



我该怎么做....请指导我

I am using textarea for allowing user to fill in some information.

User can enter many line in that and he presses enter between two paragraphs.

While submitting form i am saving textarea text in database which comes like
"test\r\n regards \r\n yours".

and while fetching that data from data it shows in same manner in textarea user has entered but not showing proper in span or div tag.

How can i do that .... please guide me

推荐答案

我在ASP.NET MVC中使用文本区域和EF一起工作,一切正常。生成的HTML代码是下一个:

I am using text area in ASP.NET MVC together with EF and everything is working fine. The generated HTML code is the next one:
<textarea name="Comments" class="valid" id="Comments" style="width: 100%;" rows="5" cols="20">Raul's Test User
aaa
bbb
ccc
ddd
eee
fff
</textarea>





原始的剃刀视图代码是:



And the original razor view code is:

@Html.TextAreaFor(model => model.Comments, new { cols = "62", rows = "10", style = "width: 99%; " })


这篇关于在Div或Span标签中不显示我在Textarea中以相同格式输入的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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