多行文本框多个换行符

7

本文介绍了多行文本框多个换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我像这样为 Multiline Textbox 设置了一个值.

I set a value for a Multiline Textbox like this.

textBox1.Text = "Line1

Line2";

但是,输出中只有一个行距.

But, only one line space in output.

当我读取文本框的值时,我读取了 "Line1 Line2";

When I read the value of textbox, I read "Line1 Line2";

为什么 ASP.NET 不支持多于一个的换行符?

Why does ASP.NET not support more then one lineline character?

推荐答案

我也遇到了同样的问题.如果我添加一个 Environment.Newline 我会在文本框中得到一个新行.但是如果我添加两个 Environment.Newline 我会得到一个新行.在我的网络应用程序中,我使用了一个空格模块来删除所有不必要的空格.如果我禁用此模块,我的文本框中会出现两行新行.希望对您有所帮助.

I had the same problem. If I add one Environment.Newline I get one new line in the textbox. But if I add two Environment.Newline I get one new line. In my web app I use a whitespace modul that removes all unnecessary white spaces. If i disable this module I get two new lines in my textbox. Hope that helps.

这篇关于多行文本框多个换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

Func<string,string> 有什么区别?和委托?
What is the difference between Funclt;string,stringgt; and delegate?(Funclt;string,stringgt; 有什么区别?和委托?)...
2023-11-11 C#/.NET开发问题
3

如何通过串口 RS-232 或 USB 转换器将体重秤的重量显示到文本框中?
How to display weight from weighing scale into a textbox via serial port RS-232 or usb converter?(如何通过串口 RS-232 或 USB 转换器将体重秤的重量显示到文本框中?)...
2023-11-10 C#/.NET开发问题
5

ASP.NET MVC 中的 <%: 和 <%= 有什么区别?
What is the difference between lt;%: and lt;%= in ASP.NET MVC?(ASP.NET MVC 中的 lt;%: 和 lt;%= 有什么区别?)...
2023-11-10 C#/.NET开发问题
0

标签系统的 linq 查询 - 搜索多个标签
linq query for tag system - search for multiple tags(标签系统的 linq 查询 - 搜索多个标签)...
2023-11-10 C#/.NET开发问题
0

论坛标签.实施它们的最佳方法是什么?
Forum tags. What is the best way to implement them?(论坛标签.实施它们的最佳方法是什么?)...
2023-11-10 C#/.NET开发问题
1

正则表达式 - 我只想匹配正则表达式中的开始标签
Regex - I only want to match the start tags in regex(正则表达式 - 我只想匹配正则表达式中的开始标签)...
2023-11-10 C#/.NET开发问题
0