在TextBox或Html区域中换行 [英] Line Break in TextBox or Html Area

查看:118
本文介绍了在TextBox或Html区域中换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在插入数据库(Asp.Net)时,MultiLine Textbox或HTML Text区域中的Line-Breaks和Space分隔的方式是什么?例如,如果我想插入

你好



世界



到换行符的数据库?同时显示我应该做什么?我不想使用编辑器。






但问题是如何分隔线条和空间。现在当我插入

你好



世界



或hello world,它会在数据库中保存为相同的字符。因此,我无法将它们分开,而我正在显示hello world,尽管用户使用上述换行符。该值来自TextBox或html区域,与换行符或空格相同。

换行符应该坚持数据库。当您检索信息并显示为Html时,只需用换行符标记(即< / code>)替换换行符(即Environment.NewLine))


What is the way of separating Line-Breaks and Space in MultiLine Textbox or HTML Text area while inserting database (Asp.Net). For example what should I do if I want to insert

Hello

World

to database with line breaks? And also While displaying what should I do? I don't want to use Editor for it.


But the problem is how to seperate line break and space. Now when I insert

Hello

World

or hello world, it is saved with same character in the database. Therefore I can't separate them and I am showing hello world although user uses line breaks such as above. The value, which comes from TextBox or html area, are the same as with line break or space.

解决方案

The line breaks should persist to the db. When you retreive the info and display as Html just replace the line break (i.e. Environment.NewLine) with a line break tag (i.e. < b r / > )

这篇关于在TextBox或Html区域中换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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